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
// bower_components | |
-- angular.js | |
-- annyang.js | |
// static | |
-- index.html | |
server.js |
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 basic( callback ){ | |
console.log( 'do something here' ); | |
var result = 'i am the result of `do something` to be past to the callback'; | |
// if callback exist execute it | |
callback && callback( result ); | |
} |
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 js(str, callback) { | |
console.log("Code"); | |
callback && callback(str); | |
} | |
js("JavaScript", function (str) { | |
console.log(str); | |
}); |
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 foo, bar = null; | |
foo = { | |
setBar: function(value) { | |
bar = value; | |
} | |
}; | |
foo.setBar(123); | |
console.log(bar); |
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 Person(gender) { | |
this.gender = gender; | |
alert('Person instantiated'); | |
} | |
// What does this line do? | |
Person.prototype.gender = ''; | |
var person1 = new Person('Male'); |
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 cheerio = require('cheerio'); | |
var request = require('request'); | |
arry = [] | |
base_url = "https://weworkremotely.com" | |
function job_hrefs(i, url, arry, callback) { | |
return request(url, function(err, res, body) { | |
var jobs = []; |
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
> x = {}; | |
{} | |
> x['0'].first_obj = "cool"; | |
TypeError: Cannot set property 'first_obj' of undefined |
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 mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/test'); | |
var db = mongoose.connection; | |
var geocoder = require("geocoder"); | |
var db = mongoose.connection; | |
db.on('error', console.error.bind(console, 'connection error: Make sure thatmongod is running')); |
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 mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/test'); | |
var db = mongoose.connection; | |
var geocoder = require("geocoder"); | |
var db = mongoose.connection; | |
db.on('error', console.error.bind(console, 'connection error: Make sure thatmongod is running')); | |
db.once('open', function callback() { |
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
// Scenario 1 | |
// run these sequentially, the google map closes | |
google.maps.event.addDomListener(window, 'load', initialize); | |
google.maps.event.clearInstanceListeners(window, 'load'); | |
// Scenario 2 | |
function run() { | |
google.maps.event.clearInstanceListeners(window, 'load'); | |
} |
OlderNewer