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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Blah</title> | |
</head> | |
<body> | |
<header> | |
<nav> | |
<ul> | |
<li>My</li> <!-- A screenreader would land here first !--> |
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
def longer_country(country1, country2): | |
return longer(get_capital(country1), get_capital(country2)); |
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
# Let's say we have a function: | |
def say_hello(): | |
print("hello") | |
# Consider: | |
pointer = say_hello # the variable 'pointer' now has the function say_hello assigned to it | |
pointer() # this will print 'hello' | |
say_hello() # this will also print hello | |
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
People.build({ | |
name: 'Whatever', | |
profile: Profile.build({ /* my-values */ }) | |
}).create({ | |
include: [Profile] | |
}) |
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
server.use((error, req, res, next) => { | |
console.log(error.stack); | |
next(error); | |
}); |
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 events = {} | |
function publish(e, message) { | |
var subscribers = events[e]; | |
subscribers.map(function(sub) { | |
sub(message); | |
}); | |
} | |
function on(e, cb) { |
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 Foo() {} | |
Foo.prototype.myState = {}; | |
Foo.prototype.myBehaviour = function() { | |
console.log('Doing something'); | |
} | |
foo = new Foo(); | |
console.log(foo.state); |
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 UserFactory($http) { | |
var factory = {}; | |
var users = {}; | |
factory.load = function load() { | |
// Return promise returned by $http.get | |
return $http.get('http://localhost:3000/users') | |
.success(function(data) { | |
angular.forEach(data, function(item, index) { | |
users[data.id] = data; |
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
// Top level app folder | |
// app/js/app.js | |
angular.module('App', [ 'Components' ]); | |
// Top level components folder | |
// app/js/components/_module.js | |
angular.module('Components', [ 'Person' ]); |
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 obj = JSON.stringify(getMyJson()); | |
console.log(obj.results.geomentry.location); |
NewerOlder