Skip to content

Instantly share code, notes, and snippets.

View scratcher28's full-sized avatar

scratcher28

  • Russia
View GitHub Profile
@scratcher28
scratcher28 / jquery.whenAll.js
Created July 28, 2011 15:52 — forked from maxim-grishaev/jquery.whenAll.js
Simple plugin for jQuery to flexibly manage $.Deferred objects. Adds possibility to push your Deferreds to stack after it's creation
(function($, undefined){
var when = $.when,
slice = window.Array.prototype.slice;
$.whenAll = function(){
var mainDfrd = $.Deferred(),
promise = mainDfrd.promise();
promise.resolved = 0;
promise.rejected = 0;
promise.total = 0;
promise.push = function(){
@scratcher28
scratcher28 / gist:b1c6f1842f782f5f9967
Created October 15, 2014 10:50
php confirm / prompt
function confirm($msg, $expert='yes|y') {
$input = propmt($msg);
return in_array(trim($input), explode('|',$expert));
}
function propmt($msg) {
echo $msg;
$handle = fopen("php://stdin","r");
return fgets($handle);
}
{
"indent" : {
"value": " ",
"ArrayExpression": 1,
"AssignmentExpression": 1,
"BinaryExpression": 1,
"ConditionalExpression": 1,
"CallExpression": 1,
"CatchClause": 1,
"ConditionalExpression": 1,
// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });