// jQuery
$(document).ready(function() {
// code
})
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
/* Get size of viewport */ | |
layout.winWidth = $(window).width(); | |
layout.winHeight = $(window).height(); | |
/* Get available width by subtracting the size of the rest of the components */ | |
var dwidth = layout.winWidth - 63; | |
var dheight = layout.winHeight - 111; | |
/* Check if scrollbars are needed (cheight and cwidth are canvas element's height and width)*/ | |
var vScrollNeeded = dheight < app.cheight; |
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 person = {}; | |
Object.defineProperty(person, 'firstName', { | |
get: function() { return firstName; }, | |
set: function(newName) { firstName = newName; }, | |
enumerable: true | |
}); | |
Object.defineProperty(person, 'lastName', { | |
get: function() { return lastName; }, |
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 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 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 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 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 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 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 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 |
OlderNewer