Skip to content

Instantly share code, notes, and snippets.

View jolby's full-sized avatar

Joel Boehland jolby

View GitHub Profile
@mfikes
mfikes / deps.clj
Created March 7, 2015 18:40
React Native dep graph
[{:file "react-native/Libraries/Animation/LayoutAnimation.js",
:provides ["LayoutAnimation"],
:requires
["ReactPropTypes"
"NativeModules"
"createStrictShapeTypeChecker"
"keyMirror"]}
{:file "react-native/Libraries/Animation/POPAnimationMixin.js",
:provides ["POPAnimationMixin"],
:requires ["POPAnimation" "invariant" "warning"]}
@ordnungswidrig
ordnungswidrig / example.clj
Created August 5, 2011 13:03
Simple clojure rpc server using read and pr to serialize messages
(def s (start-server 3000 inc false))
;; echo 10\n20\n30 | nc localhost 3000
;; => 11\n21\n31
(stop-server s)
@vvuk
vvuk / ArrayBenchmark.java
Created October 6, 2011 02:25
two NIO/Java array benchmarks
/* javac ArrayBenchmark.java
* java -Xbootclasspath/a:. ArrayBenchmark
*/
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@curtismchale
curtismchale / paypal-ipn-publish.php
Created October 18, 2011 18:12
supposed to catch the PayPal IPN response and publish posts
add_action( 'gform_paypal_post_ipn', 'tan_deal_with_posts', 10, 8 );
function tan_deal_with_posts( $ipn_post, $entry, $config, $cancel ){
global $current_user;
$time_period = $entry['1.1'];
$userid = $entry['created_by'];
if( empty( $userid ) ) $userid = $current_user->ID;
@martintrojer
martintrojer / rdf-cl.clj
Created August 16, 2012 18:36
RDF graph core.logic
;; http://www.infoq.com/presentations/core-logic
(ns rdf
(:refer-clojure :exclude [==])
(:use [clojure.core.logic]))
(def g
[[:a1 :rdf/type :sdx/FederationService]
[:a1 :rdf/type :sdx/name "movies"]
[:a1 :rdf/exposedServices :_syscoll1]
@cemerick
cemerick / gist:3657912
Created September 6, 2012 16:07
#{Ring, Compojure}-friendly shoreleave-remote backend
;;; this is now in a library: https://github.com/cemerick/shoreleave-remote-ring
(ns ^{:doc "Server-side RPC support for use with shoreleave (and maybe fetch?).
Mostly copied from https://github.com/shoreleave/shoreleave-remote-noir;
changed to eliminate the noir-isms..."}
cemerick.cljs.rpc)
(def default-remote-uri "/_fetch")
(def remotes (atom {}))
@brianleroux
brianleroux / web-based-diagramming-tools.md
Created September 8, 2012 19:37
I asked about web based diagramming tools on twitter. Ppl answered!
@richhickey
richhickey / thread.clj
Created October 13, 2012 17:43
new thread macros draft
(defmacro test->
"Takes an expression and a set of test/form pairs. Threads expr (via ->)
through each form for which the corresponding test expression (not threaded) is true."
[expr
& clauses]
(assert (even? (count clauses)))
(let [g (gensym)
pstep (fn [[test step]] `(if ~test (-> ~g ~step) ~g))]
`(let [~g ~expr
~@(interleave (repeat g) (map pstep (partition 2 clauses)))]

Array abstraction in Clojure

Few days ago Mike Anderson wrote [a proposal][mike] for a generic matrix API in Clojure which could compete with NumPy. I wanted to write a similar post for months, but was reluctant to start. This problem is very dear to me. Basically, it is a matter if I can use Clojure for most of my work, or it remains a toy language for me. Thanks to Mike for bringing the question up. Though, I have a different vision of how we should approach arrays and matrices in Clojure.

#!/bin/bash
NET=10.0.0.0/16
# i.e. 256Kbit/s
RATE_OUT=$1
# i.e. 6Mbit/s
RATE_IN=$2
DELAY_IN=$3
DELAY_OUT=$4