Skip to content

Instantly share code, notes, and snippets.

View Pet3ris's full-sized avatar
🎯
Focusing

Peteris Erins Pet3ris

🎯
Focusing
View GitHub Profile
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@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)
@swannodette
swannodette / gist:997140
Created May 28, 2011 19:26
type-inf.clj
(ns logic.y
(:refer-clojure :exclude [== reify inc])
(:use [clojure.core.logic minikanren prelude
nonrel match]))
(defna findo [x l o]
([_ [[?y :- o] . _] _]
(project [x ?y] (== (= x ?y) true)))
([_ [_ . ?c] _] (findo x ?c o)))
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
;; 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)))))))))
@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/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
@anildigital
anildigital / client.js
Created April 9, 2011 10:16
Twitter streaming API example twitter-node and socket.io
<!DOCTYPE HTML>
<head>
<title>Codesnippit NodeJS Twitter Tracker Client</title>
</head>
<body>
<ul></ul>
<script>
(function() {
var script = document.createElement("script");
script.src = "http://code.jquery.com/jquery.min.js";
@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
@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 ) {