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 animLoop( render, element ) { | |
var running, lastFrame = +new Date; | |
function loop( now ) { | |
// stop the loop if render returned false | |
if ( running !== false ) { | |
requestAnimationFrame( loop, element ); | |
var deltaT = now - lastFrame; | |
// do not render frame when deltaT is too high | |
if ( deltaT < 160 ) { | |
running = render( deltaT ); |
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
http://msdn.microsoft.com/en-us/library/windows/apps/hh696636.aspx | |
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
<h2><span data-win-res="{textContent: 'greeting'}"></span></h2> | |
and resource file with .resjson extension within strings folder: | |
eng | |
{ | |
"greeting" : "Hello", | |
"_greeting.comment" : "A welcome greeting" | |
} |
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
const xml = ` | |
<XMLText class="yeah-attributes"> | |
regular text | |
<XMLBold> | |
bold text | |
</XMLBold> | |
another text | |
</XMLText> | |
`; |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 fibonacci(){ /*...*/ } | |
var worker = new Worker( | |
"data:application/javascript;base64,"+ | |
btoa('(' + fibonacci.toString().replace(/function\s+\w+/, 'function') + ')();') | |
); | |
// More: https://plus.google.com/113853198722136596993/posts/hAtcYGc5xcw |
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
(() => { | |
try { | |
new window.ImageData(new Uint8ClampedArray([0, 0, 0, 0]), 1, 1); | |
} catch (e) { | |
function ImageDataPolyfill () { | |
let args = [...arguments], data; | |
if (args.length < 2) { | |
throw new TypeError(` | |
Failed to construct 'ImageData': 2 arguments required, but only ${args.length} present. |
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 crypto = require('crypto'); | |
// larger numbers mean better security, less | |
var config = { | |
// size of the generated hash | |
hashBytes: 32, | |
// larger salt means hashed passwords are more resistant to rainbow table, but | |
// you get diminishing returns pretty fast | |
saltBytes: 16, | |
// more iterations means an attacker has to take longer to brute force an |
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 waitFor (time, promiseFn = () => {}) { | |
const wait = new Promise(resolve => { | |
setTimeout(resolve, time); | |
}); | |
return Promise.all([promiseFn, wait]).then( | |
args => args[0] && typeof args[0] === 'function' && args[0](), | |
() => Promise.reject('Error in waitFor') | |
); | |
} |
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
#! /bin/bash | |
# The Purpose of this Script is to batch convert and compress any video file to mp4 format | |
# | |
# WARNING: LOSSY COMPRESSION !!! | |
# Variable used: | |
# sourcedir is the directory where to be converted videos are. Converted video will be saved in the same folder | |
# usage: |
OlderNewer