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
<?php | |
$a1 = array('x', 'a' => 'b', 'c', 'd', 'e'); | |
print_r($a1); | |
var_dump(is_numeric_array($a1)); // false | |
$a2 = array('a', 'b', 'c', 'd', 'e'); | |
print_r($a2); |
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
window.setTimeout(function() { | |
if ( !arguments.length ) { | |
// polyfill | |
var sto = window.setTimeout; | |
window.setTimeout = function(cb, speed) { | |
var args = []; | |
for ( var i=2; i<arguments.length; i++ ) { | |
args.push(arguments[i]); | |
} | |
sto(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
<?php | |
// Example: http://hotblocks.nl/tests/time_ago.php | |
function time_ago( $f_seconds, $f_size = 2, $f_factor = 1.6 ) { | |
$units = array( | |
86400*365.25 => array(' year', ' years'), | |
86400*30 => array(' month', ' months'), | |
86400*7 => array(' week', ' weeks'), | |
86400 => array(' day', ' days'), |
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
/** | |
* Double Opacity | |
*/ | |
body{background:green;} | |
#baz{ | |
opacity: 0.6; | |
} | |
#foo{ | |
height:150px; |
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
// As seen in bozo/custom.js | |
(function($) { | |
Drupal.behaviors.placeholderPolyfill = { | |
attach: function(context, settings) { | |
if ( !('placeholder' in document.createElement('input')) ) { | |
var onFocus = function(e) { | |
this.$this || (this.$this = $(this)); |
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
Element.prototype.matchesSelector || (Element.prototype.matchesSelector = Element.prototype.webkitMatchesSelector || Element.prototype.mozMatchesSelector || function(selecta) { | |
var els = document.querySelectorAll(selecta); | |
for ( var i=0, L=els.length; i<L; i++ ) { | |
if ( els[i] == this ) { | |
return true; | |
} | |
} | |
return false; | |
}); |
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
// <?php /* | |
exports.user = 'root'; | |
exports.password = 'secret password'; | |
exports.database = 'games'; | |
// */ |
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
curl -X PUT -d '"Jeff"' https://cr2jl3cpyv7.firebaseio.com/users/jeff/name.json | |
curl -X PUT -d '"Carla"' https://cr2jl3cpyv7.firebaseio.com/users/carla/name.json | |
curl -X PATCH -d '{"jeff/city": "Houston", "carla/city": "Atlantis"}' https://cr2jl3cpyv7.firebaseio.com/users.json | |
curl -X PATCH -d '{"jeff/family": {"children": 1, "parents": 0, "siblings": 1}, "carla/family": {"children": 4, "parents": 2, "siblings": 3}}' https://cr2jl3cpyv7.firebaseio.com/users.json | |
curl -X PATCH -d '{"jeff/family/children": 2, "carla/family/parents": 0}' https://cr2jl3cpyv7.firebaseio.com/users.json | |
{ | |
"carla":{"city":"Atlantis","family":{"children":4,"parents":0,"siblings":3},"name":"Carla"}, | |
"jeff":{"city":"Houston","family":{"children":2,"parents":0,"siblings":1},"name":"Jeff"} | |
} |
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
javascript: | |
performance.setResourceTimingBufferSize(5000); | |
performance.getEntriesByType('resource').some(function(res) { | |
if (res.name.slice(-5) == '-1.ts') { | |
console.log(res.name); | |
return prompt('COPY THIS URL', res.name), true; | |
} | |
}); | |
void(0); |
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
var net = require('net'); | |
function log(msg) { | |
process.stdout.write(msg.trim() + "\n", 'utf8'); | |
} | |
var port = Number(process.argv[2]); | |
if ( !port || isNaN(port) ) { | |
return log('Need valid PORT number as argument.'); | |
} |