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
module.exports = { | |
attributes: { | |
title: { | |
type: 'text' | |
}, | |
content: { | |
type: 'text' | |
}, | |
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
[ | |
{ | |
"matchNumber": 1, | |
"kickOff": "2015-09-18T20:00:00.000Z", | |
"pool": "A", | |
"teamA": "England", | |
"teamB": "Fiji", | |
"location": "Twickenham, London" | |
}, |
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 toto = { | |
foundation: 'Mozilla', | |
model: 'box', | |
week: 45, | |
transport: 'bus', | |
month: 7 | |
}; | |
JSON.stringify(toto); | |
// '{"foundation":"Mozilla","model":"box","week":45,"transport":"bus","month":7}' |
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
Show hidden characters
// Place user-specific overrides in this file, to ensure they're preserved | |
// when upgrading | |
{ | |
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules"] | |
} |
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
/** | |
* console.log | |
*/ | |
console.log('Hello'); | |
// → "Hello" | |
var hello = 'Hello'; | |
console.log(hello); | |
// → "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
// We are on page | |
// http://www.example.com:8080/search?q=devmo#test | |
console.log(window.location.href) | |
// → "http://www.example.com:8080/search?q=devmo#test" | |
console.log(window.location.origin) | |
// → "http://www.example.com:8080" | |
console.log(window.location.protocol) |
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
// explode -> .split | |
console.log(['Hello', 'World'].join()) // ',' is optional | |
// → "Hello,World" | |
// implode -> .join | |
console.log('Hello,World'.split(',')) | |
// → Array [ "Hello", "World" ] |
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
See http://fr.slideshare.net/pirhilton/how-to-name-things-the-hardest-problem-in-programming by @hilton | |
Summary of naming things badly : | |
- meaningless: foo | |
- too general: data | |
- too short: a | |
- too long: text_correction_by_editor | |
- abbreviated: acc (id is the only acceptable abbreviation) | |
- vague: InvoiceManager | |
- wrong: order |
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
$resource(a, b, { | |
getSomething: { | |
method: 'GET', | |
url: baseUrl + ':id' // work if you pass the `id` param in the parameters object | |
}, | |
postSomething: { | |
method: 'POST', | |
url: baseUrl + ':id', // you need to add the next line to make it work for post requests (didn't try with other verbs) | |
params: { id: '@id' } | |
} |
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
// Array | |
var list = ['my', 'str', 'list']; | |
if (~list.indexOf('my')) { | |
console.log('the `list` array contains \'my\''); | |
} | |
if (!~list.indexOf('number')) { | |
console.log('the `list` array does not contain \'number\''); | |
} |
OlderNewer