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
data State: | |
| notAsked | |
| loading | |
| failure(error) | |
| success(result) | |
end | |
fun result(state): | |
doc: "Returns custom message for given 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
{-# LANGUAGE OverloadedStrings #-} | |
import Prelude | |
import Control.Exception | |
data Err = Err String | |
instance Show Err where | |
show (Err value) = show value |
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
type stateType = { counter: int }; | |
let initialState: stateType = { counter: 0 }; | |
type actionType = | |
| Increment | |
| Decrement | |
| Reset; | |
let update action 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
// ---- | |
// libsass (v3.3.2) | |
// ---- | |
.flex { | |
display: flex; | |
&--space-around { | |
justify-content: space-around; | |
} |
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 AOP { | |
static extend(target) { | |
Object.assign(target, AOP.prototype); | |
} | |
} | |
AOP.prototype.before = function (property, fn) { | |
let oldProperty = this[property]; | |
this[property] = function () { | |
fn.apply(this, 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
class AOP { | |
static extend(target) { | |
Object.assign(target, AOP.prototype); | |
} | |
} | |
AOP.prototype.before = function (property, fn) { | |
let oldProperty = this[property]; | |
this[property] = function () { | |
fn.apply(this, 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
app.service('Wallet', function () { | |
function Wallet () { | |
this.total = 0; | |
} | |
Wallet.prototype.add = function (amount) { | |
this.total += Number(amount) || 0; | |
return this.total; | |
}; |
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 CoreRepository { | |
static inject () { | |
return []; | |
} | |
static instance () { | |
var deps = this.inject(); | |
return new this(...deps); | |
} | |
} |
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
/* sweet.js (sjs) markup, can be compiled on http://sweetjs.org/browser/editor.html */ | |
let Math.max = macro { | |
rule { ([$x ...]) } => { Math.max ($x ...) } | |
rule { ($x ...) } => { Math.max ($x ...) } | |
} | |
// 1. Regular | |
Math.max(1,2) // => Math.max(1,2) | |
Math.max(3,4,5) // => Math.max(3,4,5) |
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
describe User do | |
include ClassHelpers | |
context "new" do | |
it "should create user with role_id = 2 (registered) by default" do | |
new_valid_user.role_id.should == 2 | |
new_valid_user.registered?.should be_true | |
end |