Skip to content

Instantly share code, notes, and snippets.

View michaelsbradleyjr's full-sized avatar
💭
Dip trip, flip fantasia 🎺

Michael Bradley michaelsbradleyjr

💭
Dip trip, flip fantasia 🎺
View GitHub Profile
@banksean
banksean / mersenne-twister.js
Created February 10, 2010 16:24
a Mersenne Twister implementation in javascript. Makes up for Math.random() not letting you specify a seed value.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();
Class('My.Attribute', {
meta : Joose.Meta.Class,
isa : Joose.Managed.Attribute,
methods : {
getSetter : function () {
},
@mchampine
mchampine / pwprot.clj
Created March 13, 2011 19:13
Strong password hasher/verifier for Clojure - incorporating salt and iterations
(ns pwprot
(:import (java.security MessageDigest Security)))
;;generate n random chars
(defn gensalt [n]
(let [charseq (map char (concat
(range 48 58) ; 0-9
(range 97 123)))] ; 0-z
(apply str
(take n
@mikekelly
mikekelly / 0_README.txt
Created March 29, 2011 23:19
a sketch of application/halo+json & application/halo+xml
I've added a control element with these properties/attributes:
method ; method to use for generated request e.g. POST/PUT/DELETE
content-type ; (optional) content-type of the request body generated by the template (defaults to application/hal+xml)
schema ; contains schema for data submitted to template
template ; (optional) A string or object representing the template or form for the request.
template-href ; (optional) Contains a URI which links to a resource where the template or form can be fetched.
template-type ; (optional) URI used to identify the template format in use (defaults to mustache).
@140bytes
140bytes / LICENSE.txt
Created May 9, 2011 16:13
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@autotelicum
autotelicum / samplesFunctional.coffee
Created August 1, 2011 18:43
CoffeeScript samples for Functional from Oliver Steele
# CoffeeScript samples for Functional from Oliver Steele
# -------------------------------------------------------------------
# Documentation: http://osteele.com/sources/javascript/functional/
# Repository: https://github.com/osteele/functional-javascript
# -------------------------------------------------------------------
# Directly import the Functional library since it is not CommonJS enabled
TestWebBundle : {
saveAs : 'test-run-all.js',
contains : [
'node_modules/joose/joose-all.js',
'node_modules/scope-provider/scope-provider-all.js',
'+TestWeb'
]
@lancejpollard
lancejpollard / get-set.coffee
Created October 23, 2011 20:08
cross browser getter setters in javascript?
# http://annevankesteren.nl/2009/01/gettters-setters
# http://antimatter15.com/wp/2010/02/experiment-cross-browser-javascript-getters-and-setters/
# http://download.dojotoolkit.org/release-1.3.0/dojo-release-1.3.0/dojox/lang/observable.js
# http://webreflection.blogspot.com/2011/02/btw-getters-setters-for-ie-6-7-and-8.html
# https://gist.github.com/189354
# http://webreflection.blogspot.com/2011/03/rewind-getters-setters-for-all-ie-with.html
# http://code.google.com/p/vbclass/
# http://code.google.com/p/vbclass/source/browse/#svn%2Ftrunk%2Fmin
# https://github.com/eligrey/Xccessors/blob/master/xccessors-legacy.js
# http://jsperf.com/getter-setter
@marty-wang
marty-wang / sinon_fake_tick.coffee
Created November 16, 2011 22:55
Use SinonJS to test async functions using process.nextTick
vows = require 'vows'
should = require 'should'
sinon = require 'sinon'
class FakeTicker
constructor: ->
@_originalTick = process.nextTick
sinon
.stub(process, 'nextTick', (callback)->
setTimeout (->
@hanachin
hanachin / swank-coffee.el
Created December 6, 2011 20:21
eval region, coffee-script
;;; swank-coffee.el hanachin_
;;;
;;; Copyright (c) 2010 Ivan Shvedunov. All rights reserved.
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;;
;;; * Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.