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
/** | |
* Copyright (c) 2014, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An | |
* additional grant of patent rights can be found in the PATENTS file in | |
* the same directory. | |
*/ |
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
"use strict"; | |
require = (function e(t, n, r) { | |
function s(o, u) { | |
if (!n[o]) { | |
if (!t[o]) { | |
var a = typeof require == "function" && require;if (!u && a) return a(o, !0);if (i) return i(o, !0);throw new Error("Cannot find module '" + o + "'"); | |
}var f = n[o] = { exports: {} };t[o][0].call(f.exports, function (e) { | |
var n = t[o][1][e];return s(n ? n : e); | |
}, f, f.exports, e, t, n, r); |
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)] |
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
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
(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
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
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
(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
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 |