This file contains 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
function myExceptionHandler() {} | |
try { | |
throw new myExceptionHandler; | |
} catch (e) { | |
if (e instanceOf myExceptionHandler) { | |
// handle it | |
} | |
} |
This file contains 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
/** | |
* Selenium Query to store a time so it can be checked against a select box with timeframes spaced at 5 minute intervals | |
*/ | |
javascript{(Math.floor((parseFloat(this.browserbot.getCurrentWindow().document.getElementById('e_startTime').innerHTML.split(' ')[1].replace(':', '.'))*20) + 0.5)/20).toFixed(2).toString().replace('.', ':')} | |
// It's just doing this really | |
var time = document.getElementById('e_startTime').innerHTML; | |
console.log(time); |
This file contains 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
/** | |
* Will give you the object from a set of arrays | |
* | |
* If you wanted to retrieve the object window.frames.url when you only have a array of string parts ['frames', 'url'] | |
*/ | |
function crawl(obj, keys) { | |
var key = keys.shift(); | |
return keys.length == 0 ? obj[key] : crawl(obj[key], keys); | |
} |
This file contains 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
setInterval(function() { | |
if (element.style.visibility != 'hidden') { | |
element.style.visibility = 'hidden'; | |
} else { | |
element.style.visibility = 'visible'; | |
} | |
}, 1000); |
This file contains 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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2281636/hack.sh | sh | |
# |
This file contains 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
Object.prototype.clone = function () { | |
var obj = {}; | |
for (var prop in this) { | |
obj[prop] = this[prop]; | |
} | |
return obj; | |
}; |
This file contains 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
/*jshint forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true, strict:true, undef:true, | |
unused:true, curly:true, browser:true, indent:4, maxerr:50, globalstrict:false */ | |
/** | |
* Will fetch the Twitter embed object | |
* | |
* See https://dev.twitter.com/docs/embedded-tweets for more information | |
* | |
* @param {Int} id Twitter status ID | |
* @param {Function} callback The callback function when this is successful |
This file contains 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
$callback = $_GET['callback']; | |
$posts = []; | |
if (have_posts()) { | |
while(have_posts()) { | |
array_push(the_post()); | |
} | |
} | |
print $callback . '(' . json_encode($posts) . ')'; |
This file contains 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
// ==UserScript== | |
// @name TweetDeck Instagram | |
// @description Adds instagram to Tweetdeck | |
// @include https://tweetdeck.twitter.com/* | |
// @include chrome-extension://hbdpomandigafcibbmofojjchbcdagbl/* | |
// @version 0.1 | |
// ==/UserScript== | |
var func = function () { |
This file contains 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
/** | |
* Omit keys from an object by an Array | |
* | |
* @param Object Obj The original object | |
* @param [[string, ....] The array of blacklisted keys | |
* | |
* @returns a clone of the obj with the keys removed | |
*/ | |
var deepOmit = function (obj) { | |
var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1)); |
OlderNewer