$ brew install docker docker-compose boot2docker
$ docker-compose up
$ open http://$(boot2docker ip):8153
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
interface Node { | |
id: ID! | |
title: String! | |
} | |
interface Navigatable { | |
slug: ID! | |
sectionNavigation: String! | |
} |
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 decoder = JSONDecoder() | |
if let decoded = try? decoder.decode(Episode.self, from: encoded) { | |
print(decoded.title) | |
} |
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
extension String { | |
func capturedGroups(withRegex pattern: String) -> [String] { | |
var results = [String]() | |
var regex: NSRegularExpression | |
do { | |
regex = try NSRegularExpression(pattern: pattern, options: []) | |
} catch { | |
return results | |
} |
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
// Conditionals | |
if (myVar == 'Hello') { | |
true | |
} | |
// if (myVar === 'Hello') { | |
// return true; | |
// } | |
// Only strict equality allowed for simplicity. Conditional expression returns by default the last expression. |
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 Person = function Person(firstName, lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
Object.defineProperty(this, 'fullName', { | |
get: function get() { | |
return this.firstName + ' ' + this.lastName; | |
} | |
}); | |
}; |
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
class FinancialYear { | |
constructor(turnover, costOfGoods) { | |
this.turnover = turnover; | |
this.costOfGoods = costOfGoods; | |
Object.defineProperty(this, 'grossProfitMargin', { | |
get () { | |
const gpm = ((this.turnover - this.costOfGoods) / this.turnover) * 100; | |
return `${gpm}%`; | |
} |
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
const privateMethod = Symbol('privateMethod'); | |
export default class Service { | |
constructor () { | |
this.say = "Hello"; | |
} | |
[privateMethod] () { | |
console.log(this.say); | |
} |
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
const privateMethods = { | |
privateMethod () { | |
console.log(this.say); | |
} | |
} | |
export default class Service { | |
constructor () { | |
this.say = "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
var Service = (function () { | |
var Service = function () { | |
this.say = "Hello"; | |
} | |
Service.prototype.publicMethod = function () { | |
privateMethod.call(this); | |
} | |
var privateMethod = function () { |
NewerOlder