Skip to content

Instantly share code, notes, and snippets.

View rickbeerendonk's full-sized avatar
🎯
Focusing

Rick Beerendonk rickbeerendonk

🎯
Focusing
View GitHub Profile
@ryanflorence
ryanflorence / static_server.js
Last active June 10, 2024 02:37
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@psychemedia
psychemedia / f1TimingPDFsScrpaer.py
Created April 10, 2011 21:46
Scraperwiki script for scraping data from FIA/F1 timing sheets/PDFs
import scraperwiki
import urllib2
import lxml.etree
'''
Code to pull data out of the timing related press releases issued by FIA for Formula One races.
This code is provided solely for your own use, without guarantee, so you can publish F1 timing data,
according to license conditions specified by FIA,
without having to rekey the timing data as published on the PDF press releases yourself.
@jneira
jneira / express-sample.cljs
Created August 25, 2011 20:07
Clojurescript / node.js basic examples
(ns express_sample
(:require [cljs.nodejs :as node]))
(def express (node/require "express"))
(def app (. express (createServer)))
(defn -main [& args]
(doto app
(.use (. express (logger)))
(.get "/" (fn [req res]
@dupuy
dupuy / README.rst
Last active June 3, 2024 23:01
Common markup for Markdown and reStructuredText

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

@stuarthalloway
stuarthalloway / gist:2645453
Created May 9, 2012 15:22
Datomic queries against Clojure collections
;; Datomic example code
(use '[datomic.api :only (db q) :as d])
;; ?answer binds a scalar
(q '[:find ?answer :in ?answer]
42)
;; of course you can bind more than one of anything
(q '[:find ?last ?first :in ?last ?first]
"Doe" "John")
@nberardi
nberardi / BigDecimal.cs
Created May 12, 2012 15:17
BigDecimal type in .NET
using System;
using System.Linq;
namespace System.Numerics
{
public struct BigDecimal : IConvertible, IFormattable, IComparable, IComparable<BigDecimal>, IEquatable<BigDecimal>
{
public static readonly BigDecimal MinusOne = new BigDecimal(BigInteger.MinusOne, 0);
public static readonly BigDecimal Zero = new BigDecimal(BigInteger.Zero, 0);
public static readonly BigDecimal One = new BigDecimal(BigInteger.One, 0);
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@g-k
g-k / datomic-rest-setup.sh
Created September 10, 2012 02:04
Datomic REST API Setup
# Download from: http://downloads.datomic.com/free.html
curl -O http://downloads.datomic.com/0.8.3488/datomic-free-0.8.3488.zip
unzip datomic-free-0.8.3488.zip
cd datomic-free-0.8.3488/
# From: http://docs.datomic.com/getting-started.html
# Run the transactor
bin/transactor config/samples/free-transactor-template.properties
# Should say:
@fogus
fogus / hocs.clj
Created November 20, 2012 16:47
core.contracts with HoCs
(def C
(contract
foo
"bar"
[f n]
[(integer? n)
(_ f [n] [odd?])
=>
integer?]))
; Comments start with semicolons.
; Clojure is written in "forms", which are just
; lists of things inside parentheses, separated by whitespace.
;
; The clojure reader assumes that the first thing is a
; function or macro to call, and the rest are arguments.
;
; Here's a function that sets the current namespace:
(ns test)