Skip to content

Instantly share code, notes, and snippets.

James Weston jaw187

Block or report user

Report or block jaw187

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View yerloop.js
for( var current_index = 0; current_index < 10; current_index++ ){
var photo_path = PVL.Viewer.getPhotoPath( photos[ current_index ] );
var loadedIntoQueue = function (i) {
return function ( texture ){
console.log( 'texture loaded in queue', i, new Date() );
}
};
@jaw187
jaw187 / nodechallenge.js
Created Jan 18, 2016
Node Challenge, make this work by changing use
View nodechallenge.js
var Instance = function (options) {
this.options = options;
};
Instance.prototype.use = function (fn) {
var self = this;
process.nextTick(() => {
fn.call(self, self.options);
})
return this;
@jaw187
jaw187 / monkeypatch
Created May 14, 2015
A monkey patch which will override a method and throw an error after method is run a specific number of times
View monkeypatch
exports.forceWreckError = function (method, timer) {
var original = Wreck[method];
Wreck[method] = function () {
if (!timer) {
var callback = arguments[arguments.length - 1];
Wreck[method] = original;
return callback(new Error('foo'));
@jaw187
jaw187 / leakers
Created Apr 3, 2015
Async Leakageseses
View leakers
var bad = function (options, callback) {
var a = options.a;
doSomethingAsync(function (err, res) {
callback(err, res);
});
};
@jaw187
jaw187 / eventloopexample
Created Mar 4, 2015
Example of how the event loop works
View eventloopexample
var test1 = function () {
var options = {
hostname: 'google.com',
port: 80,
path: '/'
};
http.get(options, function (res) {
View gist:8048f2e366dfb6c9007c
// Load modules
// Declare internals
var internals = {};
module.exports.foo = internals.foo = function(args) {
// do awesome stuff
View gist:27e559b07a08b5746466
var CameraShare = function (cameraId, username, target) {
this.cameraId = cameraId;
this.fromName = username;
this.target = target;
this.branchUrl = function(cb) {
branchUrl = "http://www.google.com/"
cb(branchUrl);
View gist:fd295b01f0f601780bb5
function init() {
var pswp = new Pswp();
pswp.listen("gettingData", refreshSignedUrl(pswp));
};
function refreshSignedUrl(pswp) {
return function (index, item) {
View gist:b5020bed3afda1d48612
var compose = function (f, g) {
var inner = function (x) {
return g(f(x));
};
};
View gist:971f2a41474572405804
<div class="row">
<div class="col-md-3" id="playerContainer"></div>
<div class="col-md-6" id="playerDetailContainer"></div>
</div>
<script type="text/jsx">
var loadData = function (self) {
$.ajax({
You can’t perform that action at this time.