// jQuery
$(document).ready(function() {
// code
})
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 fs = require('fs'); | |
var net = require('net'); | |
var http = require('http'); | |
var https = require('https'); | |
var httpAddress = '/path/to/http.sock'; | |
var httpsAddress = '/path/to/https.sock'; | |
fs.unlinkSync(httpAddress); | |
fs.unlinkSync(httpsAddress); | |
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
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la) | |
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) | |
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. | |
* | |
* See working example at http://rocha.la/fun-with-pixels-html5-video-canvas | |
* | |
*/ | |
var canvasVideo = function() | |
{ | |
var $ = jQuery, |
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 requestAnimFrame = (function () { | |
return window.requestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
window.oRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
function (/* function */ callback, /* DOMElement */ element) { | |
window.setTimeout( callback, 16.667 ); | |
}; | |
})(); |
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 $this = element; //cache | |
(function loop() { | |
if (!$this.paused && !$this.ended) { | |
context.drawImage($this, 0, 0); | |
setTimeout(loop, 16.67); // drawing at 30fps | |
} | |
})(); |
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
function updateSVG() { | |
var el = document.querySelector('.icon-user'); | |
var style = window.getComputedStyle(el); | |
var uri = style.backgroundImage; | |
var svg64 = uri.replace(/^.+base64,/, "").replace(/\"?\)$/, "") | |
var xml = window.atob(svg64); | |
var hex = '#' + Math.floor(Math.random()*16777215).toString(16); | |
var color = xml.replace(/fill="#[A-Za-z0-9]+"/, 'fill="' + hex + '"'); | |
var color64 = window.btoa(color); | |
var colorUri = "url('data:image/svg+xml;base64," + color64 + "')"; |
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
<!DOCTYPE html> | |
<html> | |
<head lang="en"> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
var httpRequest; | |
if (window.XMLHttpRequest) { // Mozilla, Safari, ... |
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
#!/usr/bin/env python | |
# Clone or update all a user's gists | |
# curl -ks https://gist.githubusercontent.com/fedir/5466075/raw/gist-backup.py | USER=fedir python | |
# USER=fedir python gist-backup.py | |
import json | |
import urllib | |
from subprocess import call | |
from urllib import urlopen | |
import os |
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 | |
// root path | |
$path = realpath('.'); | |
// finds everything in $path including root directory | |
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); | |
$success = 0; | |
$error = 0; | |
$skipped = 0; |
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 | |
class BobTest { | |
public function PublicMethod() { return; } | |
protected function ProtectedMethod() { return; } | |
private function PrivateMethod() { return; } | |
public function TestCallables() { | |
echo "testing myself...", PHP_EOL; |