Skip to content

Instantly share code, notes, and snippets.

View yohio's full-sized avatar

Y. John Ararat yohio

View GitHub Profile
@gabrielmerovingi
gabrielmerovingi / mycred-for-wp-pro-quiz
Last active January 30, 2017 08:01
Custom myCRED Hook allowing you to award / deduct points from users when they complete a quiz via the WP Pro Quiz Plugin. Requires myCRED 1.5.3 or higher.
/**
* WP-Pro-Quiz Hook
* @version 1.3
* @author Gabriel S Merovingi
*/
add_filter( 'mycred_setup_hooks', 'register_wp_pro_quiz_hook_in_mycred' );
function register_wp_pro_quiz_hook_in_mycred( $installed ) {
$installed['wpproquiz'] = array(
'title' => __( 'WP-Pro-Quiz', 'textdomain' ),
# METEOR CORE:
Anywhere: Meteor.isClient
Anywhere: Meteor.isServer
Anywhere: Meteor.startup(func)
Anywhere: Meteor.absoluteUrl([path], [options])
Anywhere: Meteor.settings
Anywhere: Meteor.release
@kmaida
kmaida / convert-UNIX-timestamp.js
Last active January 2, 2025 21:01
Convert a UNIX timestamp to user's local time via JavaScript
function convertTimestamp(timestamp) {
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
yyyy = d.getFullYear(),
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
hh = d.getHours(),
h = hh,
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
ampm = 'AM',
time;
@PizzaBrandon
PizzaBrandon / jquery.waituntilexists.js
Last active August 24, 2023 14:23 — forked from buu700/jquery.waituntilexists.js
Updated waitUntilExists plugin
;(function ($, window) {
var intervals = {};
var removeListener = function(selector) {
if (intervals[selector]) {
window.clearInterval(intervals[selector]);
intervals[selector] = null;
}
@KruegerDesigns
KruegerDesigns / ios.html.class.js
Created February 1, 2012 18:17
Add iOS class to html tag for iphone, ipod, and ipad.
// adds ios class to html tag
jQuery(document).ready(function($){
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if (agentID) {
$('html').addClass('ios');
}
});
@localpcguy
localpcguy / swipeFunc.js
Created November 17, 2011 16:00
Simple Mobile Swipe function to get the swipe direction
var swipeFunc = {
touches : {
"touchstart": {"x":-1, "y":-1},
"touchmove" : {"x":-1, "y":-1},
"touchend" : false,
"direction" : "undetermined"
},
touchHandler: function(event) {
var touch;
if (typeof event !== 'undefined'){