This file contains hidden or 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
componentDidMount() { | |
axios.get('https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty') | |
.then(response => { | |
let posts = []; | |
const lastPostIndex = response.data.length - 1; | |
for (var i = 0; i < response.data.length; i++) { | |
axios.get('https://hacker-news.firebaseio.com/v0/item/' + response.data[i] + '.json?print=pretty') | |
.then(post => { | |
posts.push(post.data); | |
if (i === lastPostIndex) { |
This file contains hidden or 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 ChangesStream = require('changes-stream'); | |
const db = 'https://replicate.npmjs.com'; | |
var changes = new ChangesStream({ | |
db: db, | |
include_docs: true | |
}); | |
let count = 0; |
This file contains hidden or 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 sinon from 'sinon'; | |
import _ from 'lodash'; | |
import expect from 'expect'; | |
let eachStub = sinon.stub(_, 'each').returns(null); | |
expect(eachStub).calledOnce(); |
This file contains hidden or 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 array = [ | |
{ | |
name: 'red', | |
vlaue: 7 | |
}, | |
{ | |
name: 'red', | |
vlaue: 7 | |
}, | |
{ |
This file contains hidden or 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( "http://www.puregym.com/gyms/belfast-adalaide-street/whats-happening", function( data ) { | |
var inTheGym = $("<div></div>" ).html(data).find('.people-number').html(); | |
alert(inTheGym); | |
}); |
This file contains hidden or 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(root, module) { | |
if (typeof exports == 'object') { | |
module.exports = module(); | |
} else if (typeof define == 'function' && define.amd) { | |
define(module); | |
} else { | |
root.Fizzbuzz = module(); | |
} | |
}(this, function () { | |
var FIZZ_NUMBER = 3; |
This file contains hidden or 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
onChange: function(){}, | |
onFoo: function(){}, | |
onBar: function(){} | |
// changed to | |
onChange: $.noop, | |
onFoo: $.noop, | |
onBar: $.noop |
This file contains hidden or 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
promiseFunction(inputData).then(function() { | |
}); | |
//Can be changed to | |
promiseFunction(inputData).then($.noop()); |
This file contains hidden or 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
jQuery.fn.someAjaxStyleFunc = function(url, complete) { | |
return jQuery.ajax(url || this.url) | |
.complete(complete || jQuery.noop); | |
}; |
This file contains hidden or 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
special: { | |
ready: { | |
// Make sure the ready event is setup | |
setup: jQuery.bindReady, | |
teardown: jQuery.noop | |
} |