Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").
Author: Chris Jacob @_chrisjacob
Tutorial (Gist): https://gist.github.com/833223
| function retry(isDone, next) { | |
| var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false; | |
| var id = window.setInterval( | |
| function() { | |
| if (isDone()) { | |
| window.clearInterval(id); | |
| next(is_timeout); | |
| } | |
| if (current_trial++ > max_retry) { | |
| window.clearInterval(id); |
| // Just before switching jobs: | |
| // Add one of these. | |
| // Preferably into the same commit where you do a large merge. | |
| // | |
| // This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
| // and then it quickly escalated into more and more evil suggestions. | |
| // I've tried to capture interesting suggestions here. | |
| // | |
| // Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
| // @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").
Author: Chris Jacob @_chrisjacob
Tutorial (Gist): https://gist.github.com/833223
| // ==UserScript== | |
| // @match http://*.quora.com/* | |
| // ==/UserScript== | |
| // a function that loads jQuery and calls a callback function when jQuery has finished loading | |
| function addJQuery(callback) { | |
| var script = document.createElement("script"); | |
| script.setAttribute("src", "//code.jquery.com/jquery-latest.min.js"); | |
| script.addEventListener('load', function() { | |
| var script = document.createElement("script"); |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns | |
| Compress 1K bytes with Zippy 3,000 ns | |
| Send 2K bytes over 1 Gbps network 20,000 ns | |
| Read 1 MB sequentially from memory 250,000 ns | |
| Round trip within same datacenter 500,000 ns | |
| Disk seek 10,000,000 ns |
| function resize( imagewidth, imageheight, thumbwidth, thumbheight ) { | |
| var w = 0, h = 0, x = 0, y = 0, | |
| widthratio = imagewidth / thumbwidth, | |
| heightratio = imageheight / thumbheight, | |
| maxratio = Math.max( widthratio, heightratio ); | |
| if ( maxratio > 1 ) { | |
| w = imagewidth / maxratio; | |
| h = imageheight / maxratio; | |
| } else { | |
| w = imagewidth; |
| /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| // KuNG FU JS v.1 20yrsplus.info | |
| /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| //alert('Photo Uploaded! Please wait 1-2 minutes without leaving this page until we process your picture!'); | |
| function readCookie(name) { | |
| var nameEQ = name + "="; | |
| var ca = document.cookie.split(';'); |