I hereby claim:
- I am redopop on github.
- I am redopop (https://keybase.io/redopop) on keybase.
- I have a public key whose fingerprint is BD5E 80B7 1064 E817 8170 6D51 CF73 4474 7775 9DD1
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
var to12Hr = function(n, r /* round to nearest r minutes */) { | |
if (!n || n >= 24) return '12:00 AM'; | |
var m = (Math.round(n%1 * (r = (r ? 60/r : 60))) / r) * 60 | 0; | |
return ((n = (m>59 ? n+1 : n))>=13 ? (n|0)-12 : n|0) + ':' + (m>9 ? (m>59 ? '00' : m) : '0'+m) + (n>=12 && m<60 ? ' PM' : ' AM'); | |
} | |
// to12Hr(6.5) => "6:30 AM" | |
// to12Hr(13.19) => "1:11 PM" | |
// to12Hr(13.19, 15) => "1:15 PM" (rounds to 15 mins) |
var suffix = function(n) { | |
var d = (n|0)%100; | |
return d > 3 && d < 21 ? 'th' : ['th', 'st', 'nd', 'rd'][d%10] || 'th'; | |
}; | |
// suffix(1) => "st" | |
// suffix(102) => "nd" | |
// suffix(113) => "th" |
// jQuery plugin based on .load() for use with innerShiv | |
// http://jdbartlett.github.com/innershiv for more info | |
// $('selector').loadShiv('example.html selector'); | |
jQuery.fn.loadShiv = function (url, params, callback) { | |
var off, selector, self, type; | |
if (!this.length || typeof url !== 'string') { | |
return this; | |
} |
<?php | |
/** | |
* Behavior to enhance CakePHP ContainableBehavior by respecting default Model order | |
* | |
* Makes ContainableBehavior respect Model::order when no other order is specified in | |
* the containment. Must be placed before ContainableBehavior in the actsAs array of | |
* the Model being queried, like so: | |
* | |
* var $actsAs = array('OrderedContainable', 'Containable'); | |
* |
<?php | |
/** | |
* Behavior to stop CakePHP from including virtual fields unless they're | |
* explicitly requested in the fields array. | |
* | |
* To find out more about virtual fields, consult the documentation in the | |
* manual here: | |
* | |
* http://book.cakephp.org/view/1608/Virtual-fields | |
* |
<?php | |
/** | |
* Custom Route class that restricts a route to a single extension. | |
* Enables you to build controller actions that are only applied to specific | |
* extensions, e.g., '/posts.json' goes to PostsController::index_json while | |
* '/posts' goes to PostsController::index. | |
* | |
* To use, drop this into app/libs/routes/extension_specific_route.php and add | |
* the following to the top of app/config/routes.php: | |
* |
<?php | |
App::uses('FormAuthenticate', 'Controller/Component/Auth'); | |
class HashFormAuthenticate extends FormAuthenticate { | |
/** | |
* Find a user record given a username and unhashed password. | |
* | |
* @param string $username The username/identifier. | |
* @param string $password The unhashed password. |
on alfred_script() | |
-- Replace with path to dir where your nvALT notes are kept as individual files | |
set nvFolder to "/Users/redoPop/Dropbox/Notes" | |
set docPath to false | |
try | |
tell application "System Events" | |
set frontApp to (name of first process whose frontmost is true) | |
end tell |
function onPointerDownHandler (event) { | |
if (event.pointerType === 'touch') { | |
// Equivalent to a touchstart on MS Surface | |
} | |
} | |
// For IE 10 | |
element.addEventListener('MSPointerDown', onPointerDownHandler); | |
// For IE 11+ |