Skip to content

Instantly share code, notes, and snippets.

View Pet3ris's full-sized avatar
🎯
Focusing

Peteris Erins Pet3ris

🎯
Focusing
View GitHub Profile
diff --git a/example/server.js b/example/server.js
index 167fc43..db758a2 100644
--- a/example/server.js
+++ b/example/server.js
@@ -61,4 +61,16 @@ io.on('connection', function(client){
client.on('disconnect', function(){
client.broadcast({ announcement: client.sessionId + ' disconnected' });
});
-});
\ No newline at end of file
@joemccann
joemccann / bitly-node.md
Created October 26, 2010 13:59
Bitly shortening from the command line with node, motherfuckers.
@joemccann
joemccann / HTML5_Suggested_Boilerplates.md
Created January 18, 2011 22:39
A compendium of HTML5 related scripts, frameworks and templates/boilerplates alongside suggested best practices.
@joemccann
joemccann / turbo_stylesheet.less
Created January 23, 2011 16:19
A mirror of Jeffrey Way's CSS3 "Classes" Stylesheet
/* http://snipplr.com/view.php?codeview&id=47181 */
/* Credit: Jeffrey Way */
.border-radius( @radius: 3px ) {
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
}
.outline-radius( @radius: 3px ) {
;; peteris's solution to http://4clojure.com/problem/31
#(let [[elt cnt]
(let [v (vec %), n (count %)]
(loop [i 1, elt [(first v)], cnt [1]]
(if (= i n)
[elt cnt]
(recur (inc i)
(if (= (v i) (v (dec i)))
elt
@jColeChanged
jColeChanged / gist:938272
Created April 23, 2011 04:16
A Nifty Clojure Function
(defn fn-and
"Takes a set of functions and returns a fn which returns whether
every item in the juxtaposition of those functions is true."
([& fns]
(let [juxted-fns (apply juxt fns)]
(fn [& args] (every? true? (apply juxted-fns args))))))
;; peteris's solution to http://4clojure.com/problem/50
#(loop [s %, acu {}]
(if (= '() s)
(map reverse (vals acu))
(recur (rest s)
(if (nil? (find acu (type (first s))))
(assoc acu (type (first s)) (list (first s)))
(assoc acu (type (first s)) (cons (first s) (get acu (type (first s)))))))))
@acfoltzer
acfoltzer / amb.scm
Created February 21, 2012 22:20
amb with ivars
;; Adam Foltzer
;; amb with ivars
(load "pmatch.scm")
;;;; Global scheduler queue and helpers; ugly!
(define *q* '())
(define push-right!
(lambda (x)
@nahurst
nahurst / latency.txt
Created September 13, 2012 01:34 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers Time Light Distance Approximate Light Distance
-------------------------- ---- -------------- --------------------------
L1 cache reference 0.5 ns 0.15 m Diagonal across your smartphone
Branch mispredict 5 ns 1.5 m Height of Natalie Portman
L2 cache reference 7 ns 2.1 m Height of Shaq
Mutex lock/unlock 25 ns 7.5 m Height of a school flag pole
Main memory reference 100 ns 30 m Half a Manhattan city block (North/South)
Compress 1K bytes with Zippy 3,000 ns 900 m Width of Central Park
Send 1K bytes over 1 Gbps network 10,000 ns 3,000 m Width of Manhattan
Read 4K randomly from SSD* 150,000 ns 45,000 m NYC to Hempstead on Long Island
@jessykate
jessykate / Jekyll nd Octopress Liquid tag for MathJax.rb
Created February 18, 2011 23:37
A simple liquid tag for Jekyll/Octopress that converts {% m %} and {% em %} into inline math, and {% math %} and {% endmath %} into block equations, by replacing with the appropriate MathJax script tags.
module Jekyll
class MathJaxBlockTag < Liquid::Tag
def render(context)
'<script type="math/tex; mode=display">'
end
end
class MathJaxInlineTag < Liquid::Tag
def render(context)
'<script type="math/tex">'
end