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
import Html exposing (..) | |
-- MODEL | |
type alias Model = | |
{} | |
-- UPDATE |
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
import Html exposing (..) | |
-- MODEL | |
type alias Model = | |
{} | |
-- UPDATE |
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
require 'benchmark' | |
n = 5_000_000 | |
Benchmark.bmbm do |x| | |
x.report('String#match') do | |
n.times do | |
'metadata:foo=bar'.match(/metadata:/) | |
end | |
end |
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
irb(main):001:0> str = 'This is my STRING!' | |
=> "This is my STRING!" | |
irb(main):002:0> def str.-@ | |
irb(main):003:1* downcase | |
irb(main):004:1> end | |
=> :-@ | |
irb(main):005:0> p str | |
"This is my STRING!" | |
=> "This is my STRING!" | |
irb(main):006:0> p -str |
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
import { Component } from "React"; | |
export const Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
super() | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: '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
beforeAll(() => { | |
console.error = error => ( | |
throw new Error(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
diff --git a/src/components/Article.js b/src/components/Article.js | |
new file mode 100644 | |
index 0000000..fef5d8a | |
--- /dev/null | |
+++ b/src/components/Article.js | |
@@ -0,0 +1,55 @@ | |
+import React, { PropTypes, Component } from 'react' | |
+ | |
+// stateful component (w/ state) | |
+class Article extends Component { |
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 User { | |
// ... | |
handleChange = e => { | |
} | |
} |
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
import React from "react" | |
import { render } from "react-dom" | |
const mountNode = document.createElement("div") | |
mountNode.id = "container" | |
document.body.appendChild(mountNode) | |
const name = "David" |
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 list() { | |
return [].slice.call(arguments, 0); | |
} | |
var list = list(1, 2, 3); // [1, 2, 3] |