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
<h1 class="ir-logo"> | |
<span>My Site</span> | |
</h1> |
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
# Add ll like linux | |
alias ll='ls -l' | |
# type 'srv' in any folder to open a web browser and chrome | |
alias srv='python -m SimpleHTTPServer 8000' | |
export NVM_DIR=~/.nvm | |
source $(brew --prefix nvm)/nvm.sh | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* |
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
<div id='container'> | |
<img src='assets/slideshow_3.png' id='myimage' /> | |
</div> | |
<p style='text-align: center'> | |
Click the image to expand - Hit the ESC key to collapse | |
</p> | |
<style type="text/css"> |
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
<div id="new_panel"> | |
<div> | |
Lorem ipsum... | |
</div> | |
<div class="blurb"> | |
<div> | |
Lorem ipsum... | |
<div> | |
<em>This is what we're doing!</em> | |
</div> |
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 StateController = new function(){ | |
this.GetState = function(){ | |
$(document).trigger('navestate:giveMeTheState',this) | |
}; | |
this.hereYouGo = function(navState){ | |
// Do something with navState | |
}; | |
}; | |
var NavState = new function(){ |
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
// Our higher order function which converts pennies to pounds (£) (or cents to dollars, for that matter) | |
function convertPenniesToPounds(priceFunction) { | |
return function() { | |
return priceFunction.apply(this, arguments)/100; | |
} | |
} | |
// we have component which fetches a price in pennies | |
const PriceFetcher = { | |
getPriceInPence : function(productId) { |
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
// Our higher order function which logs all returned values to the function properties on an object | |
function attachLogger(objectOrFunction) { | |
if(typeof objectOrFunction === 'function'){ | |
return function() { | |
let ret = objectOrFunction.apply(this, arguments); | |
console.log(ret); | |
return ret; | |
} | |
} | |
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 FactorySentinal = Symbol('ClassFactory'); | |
export function isFactory(SupposedFactory) { | |
return SupposedFactory && SupposedFactory[FactorySentinal]; | |
} | |
export default function(methodComposer) { | |
return ClassToCompose => { | |
const proto = ClassToCompose.prototype; | |
function factory() { | |
const instance = new ClassToCompose(...arguments); |
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 MyConstructor() { | |
} | |
// meant to be called this way: | |
var myInstance = new MyConstructor(); | |
// but could also be called, usually incorrectly, this way | |
var myInstance = MyConstructor(); |
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
export default function(methodComposer) { | |
return ClassToCompose => { | |
const proto = ClassToCompose.prototype; | |
return class extends ClassToCompose { | |
constructor() { | |
super(...arguments); | |
for (const prop of Object.getOwnPropertyNames(proto)) { | |
const method = proto[prop]; | |
const {configurable, writable} = Object.getOwnPropertyDescriptor(proto, prop); |
OlderNewer