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 '[clojure.core.async :refer [alt! <!! chan go-loop]]) | |
(defn events [quit-ch {perpage :perpage offset :offset orderby :orderby}] | |
(let [out-port (chan) | |
(go-loop [offset offset] | |
(let [res (client/get | |
(str "https://api.meetup.com/2/events?page=" perpage | |
"&offset=" offset | |
"&orderby=" orderby | |
"&status=upcoming,past&" |
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 Tyche(seed, idx) { | |
this.a = seed & 0xffffffff; | |
this.b = (seed / ((2<<16)*(2<<16))) & 0xffffffff; | |
this.c = 2654435769; | |
this.d = (1367130551 ^ idx) >>> 0; | |
for (var i = 20; i > 0; --i) { | |
this._mix(); | |
} | |
} |
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
<html> | |
<head> | |
<script src="out/goog/base.js" type="text/javascript"></script> | |
<script src="hello_world.js" type="text/javascript"></script> | |
<script type="text/javascript">goog.require("hello_world.core");</script> | |
</head> | |
<body> | |
</body> | |
<script type="text/javascript">hello_world.core.run()</script> | |
</html> |
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
(ns cljs-cat.core | |
(:require [cljs.core.async :refer [chan sliding-buffer put! close! <! >!]] | |
[clojure.string :as string] | |
[cljs.nodejs :refer [require]]) | |
(:require-macros [cljs.core.async.macros :as m :refer [go alts!]]) | |
) | |
(defn log [& args] | |
(let [now (js/Date.) | |
time-str (format "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ" |
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 'sequel' | |
require 'tsort' | |
class TableCleaner | |
def initialize db, excluded_tables | |
@db = db | |
@excluded_tables = excluded_tables | |
end | |
def clean |
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
#define _XOPEN_SOURCE 700 | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char **argv) { | |
int size = atoi(argv[1]); | |
char **resrv = calloc(size, sizeof(char*)); | |
int i = 0; size_t nread; | |
char *line = NULL; |
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_relative 'mpsc' | |
class LoggerProxy | |
def initialize target | |
@target = target | |
@queue = MpscQueue.new | |
end | |
def start! | |
@reader, @writer = IO.pipe |
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
In [17]: pytz.UTC.localize(datetime.utcnow()).isoformat() | |
Out[17]: '2013-05-16T17:06:19.394052+00:00' | |
In [18]: (datetime.utcnow()).isoformat() | |
Out[18]: '2013-05-16T17:06:24.842408' | |
In [19]: |
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
1 require 'rack/cors' | |
2 require 'sinatra' | |
3 | |
4 get '/' do | |
5 "Hello world" | |
6 end | |
7 | |
8 use Rack::Cors do | |
9 allow do | |
10 origins 'localhost:3000', '127.0.0.1:3000', |
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 'hamster/hash' | |
original = Hamster.hash :foo => 42 | |
dumped = Marshal.dump(original) | |
undumped = Marshal.load(dumped) | |
STDERR.puts undumped[:foo] | |
STDOUT.puts dumped |