This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: function autoFollowBugWorkaround() { | |
if (followid === 7) { | |
followid = 0 | |
} else { | |
followid++ | |
} | |
$('.appFollow').eq(followid).mousedown() | |
} | |
function autoFollow() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// child | |
window.addEventListener("message", function(e) { | |
alert(e.data) | |
}, false); | |
// parent | |
window.addEventListener("message", function(e) { | |
e.source.postMessage(e.data, '*'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
files=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$") | |
if [ "$files" = "" ]; then | |
exit 0 | |
fi | |
pass=true | |
echo "\nValidating JavaScript:\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Extend the Underscore object with the following methods */ | |
// Rate limit ensures a function is never called more than every [rate]ms | |
// Unlike underscore's _.throttle function, function calls are queued so that | |
// requests are never lost and simply deferred until some other time | |
// | |
// Parameters | |
// * func - function to rate limit | |
// * rate - minimum time to wait between function calls | |
// * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var baseUrl = window.location.hostname, mobile = Modernizr.mq("only screen and ( max-device-width: 568px )"), largeScreen = Modernizr.mq("only screen and ( min-device-width: 1200px )"), prevSc = 0, loaded = !1, hasFlash = !1; | |
try { | |
var fo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); | |
fo && (hasFlash = !0) | |
} catch (e$$12) { | |
void 0 != navigator.mimeTypes["application/x-shockwave-flash"] && (hasFlash = !0) | |
} | |
function cl() { | |
var c = document.getElementsByTagName("body")[0]; | |
c.className += " loaded"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
example web app OAuth flow | |
1. Redirect users to request GitHub access (public key) | |
GET https://github.com/login/oauth/authorize | |
2. GitHub redirects back to your site | |
* Exchange this for an access token: (private key) | |
POST https://github.com/login/oauth/access_token |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://npmjs.org/install.sh | sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parse.initialize("LbGtGcj94CuXDLUzSYo4tCUX7qKrBq8AXy2F6lF3", "P8NkRtbeGe7a7BgbCRBsMEbZgmo7zN3vlhmQW3sk"); | |
var InputObj = Parse.Object.extend("InputObj"); | |
var inputObj = new InputObj(); | |
var saveToParse = function(inputVal){ | |
inputObj.save({input: inputVal}, { | |
success: function(object) { | |
console.log("saved data to parse.com"); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MODULE = (function(){ | |
// define variable in closure | |
var module = {} | |
module.UI = function(){ | |
alert('invoked module.UI') | |
} | |
module.behavior = function(){ | |
alert('invoked module.behavior') | |
} | |
return module |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The Header for our theme. | |
* | |
* Displays all of the <head> section and everything up till <div id="main"> | |
* | |
* @package WordPress | |
* @subpackage Twenty_Twelve | |
* @since Twenty Twelve 1.0 | |
*/ |