This file contains hidden or 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
#cloud-config | |
coreos: | |
etcd: | |
discovery: https://discovery.etcd.io/eeb0198338641f5c9b3c4f996bca8fc9 | |
addr: $private_ipv4:4001 | |
peer-addr: $private_ipv4:7001 | |
units: | |
- name: etcd.service | |
command: start |
This file contains hidden or 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
`/** @jsx React.DOM */` | |
# The above line HAS to be the first line in the file for JSX to know to process it. | |
MySimpleComponent = React.createClass | |
render: -> `<pre>{this.props.mytext}</pre>pre>` | |
MyComponent = React.createClass | |
render: -> | |
`( | |
<ul> | |
{this.props.items.map( |
This file contains hidden or 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 'eventmachine' | |
require 'amqp' | |
EventMachine.run { | |
conn = AMQP.connect(:host => '127.0.0.1') | |
puts "Connecting to RabbitMQ. Running #{AMQP::VERSION} version of the gem..." | |
ch = AMQP::Channel.new(conn) | |
q = ch.queue("amqpgem.examples.hello_world", :auto_delete => true) | |
x = ch.default_exchange |
This file contains hidden or 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
(defmacro joiner | |
[headers] | |
(let [extra [1 2 3] | |
joined (string/join "," (concat headers extra))] | |
`(some.one/doit ~joined))) | |
(defmacro joiner2 | |
[headers] | |
(let [extra [1 2 3]] | |
`(some.one/doit (string/join "," (concat ~headers ~extra))))) |
This file contains hidden or 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
render: -> | |
React.DOM.div({class : 'wpbar'}, [ | |
React.DOM.div({class : 'pbar'}, [ | |
React.DOM.div({class : 'pbbar' | |
style : {width : ( | |
Math.floor(@state.t * 100) + '%')}}) | |
]) | |
React.DOM.div({class : 'plabel'}, @state.phrase) | |
]) |
This file contains hidden or 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
render: -> | |
React.DOM.div({className : 'wpbar'}, [ | |
React.DOM.div({className : 'pbar'}, [ | |
React.DOM.div({className : 'pbbar',\ | |
style : {width : ( | |
Math.floor(@state.t * 100) + '%')}}) | |
]) | |
React.DOM.div({className : 'plabel'}, @state.phrase) | |
]) |
This file contains hidden or 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
(defn cubic-out [t b c] | |
(+ b (* c t t t))) | |
(defn ease-chan | |
[f b c step duration] | |
(let [out (chan)] | |
(go (doseq [t (range 0 duration step)] | |
(put! out (+ b (* (- c b) (f (/ t duration) 0 1)))) | |
(<! (timeout step))) | |
(put! out c)) |
This file contains hidden or 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
In [1]: def one(a=1,b=2): | |
...: print("a",a,"b",b) | |
...: | |
In [2]: one() | |
('a', 1, 'b', 2) | |
In [3]: one(*[2]) | |
('a', 2, 'b', 2) |
This file contains hidden or 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
user=> (defn map-vals [f m] | |
#_=> (into {} (for [[k v] m] [k (f v)]))) | |
#'user/map-vals | |
user=> | |
user=> (defn collect [ms] | |
#_=> (apply merge-with concat | |
#_=> (for [m ms] (map-vals list m)))) | |
#'user/collect | |
user=> |
This file contains hidden or 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
(defn camera | |
[x y] | |
(let [proj (js/mat4.perspective cam-proj | |
(/ js/Math.PI 4) (/ width height) 0.1 1000) | |
view (-> (js/mat4.identity cam-view) | |
(js/mat4.translate cam-view #js [0 0 (- camera-distance)]) | |
(js/mat4.rotateX cam-view (/ y camera-speed)) | |
(js/mat4.rotateY cam-view (/ x camera-speed)) | |
(js/mat4.translate cam-view #js [0 (- (/ wall-height 2)) 0])) | |
viewr (js/mat3.fromMat4 cam-viewr view)] |