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 mouse = { x : 0, y : 0 }; | |
document.addEventListener('mousemove', function (e) { | |
mouse.x = e.clientX || e.pageX; | |
mouse.y = e.clientY || e.pageY; | |
}) | |
var track = function () { | |
console.log(document.elementFromPoint(mouse.x, mouse.y)); | |
setTimeout(track, 3000); | |
} |
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
/* | |
An array shuffler with good randomness | |
*/ | |
package main | |
import ( | |
"fmt" | |
"math/big" | |
"crypto/rand" | |
) |
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
/* | |
A bunch of slice helper functions | |
All of these modify the original slice | |
*/ | |
package main | |
import ( | |
"fmt" | |
) |
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
# This use wget to download the file with: | |
# infinite retries | |
# keep retrying even when there is no connection | |
# wait 3s between retries | |
# continue from last point if failed and there is a file named test.file in the target directory | |
# with limited bandwidth rate of 2 000 000 Bytes/s | |
# and put the file to the path/filename | |
wget -t 0 --retry-connrefused --waitretry=3s -c --limit-rate=2000000 --output-document=~/Downloads/test.file http://localhost/file/test.file |
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
/* | |
* Node.js file upload using request.js, the example | |
* Does not work in Node.js v0.12.x yet @2015-03-05 using [email protected] | |
* Usage : node FileUpload.js /my/path/to/file.txt http://mysite/upload 10 3000 | |
*/ | |
var fs = require("fs"), | |
request = require("request"), | |
filepath = process.argv[2], | |
targetUrl = process.argv[3], |
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 canvas = $('<canvas />', { width: '1', height: '1' }).appendTo('body'); | |
var webglVersion = window.location.search.indexOf('v=2') > 0 ? 2 : 1; | |
var gl; | |
var possibleNames = (webglVersion === 2) ? ['webgl2', 'experimental-webgl2'] : ['webgl', 'experimental-webgl']; | |
var contextName; | |
possibleNames.forEach(function (name) { | |
gl = canvas[0].getContext(name, { stencil : true }); | |
contextName = !!gl; | |
}); |
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 prevElem = null; | |
// find out how to put prevElem as property and access it from update function | |
ko.bindingHandlers.fadeVisible = { | |
init: function(element, valueAccessor) { | |
var value = ko.unwrap(valueAccessor()); | |
$(element).toggle(value); | |
}, | |
update: function(element, valueAccessor) { | |
var value = ko.unwrap(valueAccessor()); |
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
import ( | |
"os" | |
"sync" | |
"time" | |
) | |
type RotateWriter struct { | |
lock sync.Mutex | |
filename string // should be set to the actual filename | |
fp *os.File |
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
The Miller quick coupler comes in a few different sizes. The one I tried out has the proportions of a laundry bin and weighs nearly 700 pounds. It allows the operators of hydraulic digging machines to switch buckets without ever leaving the cab. Two flanges rise from its sides, supplying it with the Volkswagen-like curves that inspired its nickname, the Bug. The flanges are drilled clean through with four holes set inside four bosses; beneath the front pair of holes are two upturned latches, like the open ends of two wrenches. Other than its poppy-red color, the device appears to be an ordinary specimen from the menagerie of heavy-duty construction equipment. | |
But in a Chicago courtroom on Oct. 26, the Bug will star in a multimillion-dollar dispute that represents a new frontier in the march of global capitalism. The nominal occasion is a paternity feud between two of the Bug’s corporate parents, Miller UK, the equipment manufacturer based in Cramlington, England, and Caterpillar, the American construction-e |
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
class Ring { | |
constructor(...data) { | |
this.position = 0; | |
if (data instanceof Array) { | |
this.data = data[0]; | |
return; | |
} | |
this.data = data; | |
} |
OlderNewer