Skip to content

Instantly share code, notes, and snippets.

(ns sieve
(:use clojure.test))
(defn square [x] (* x x))
(defn seq-contains? [ls x]
(boolean (some #(= x %) ls)))
(defn multiple-of? [product divisor]
(and (= 0 (mod product divisor))
@sl4m
sl4m / mice.css
Created September 10, 2010 16:16 — forked from jeffkreeftmeijer/mice.css
.mouse, #preview{
position: absolute;
background-repeat: no-repeat;
height: 22px;
min-width: 15px;
z-index: 100;
}
.mouse{
background-image: url('../images/cursor.png');
// need to mess with document.defaultAction = true/false to block default action;
// idea from http://www.quirksmode.org/js/keys.html
window.onload = function () {
var keyCodeUp,
keyCodeDown,
currentIndex,
fonts,
currentFont,
setGlobalFont,
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@sl4m
sl4m / about.md
Last active December 11, 2015 15:38 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@sl4m
sl4m / 2011-09-29-why-you-dont-get-mock-objects.md
Created September 29, 2011 18:21 — forked from jasonrudolph/2011-09-29-why-you-dont-get-mock-objects.md
RubyConf 2011: Why You Don't Get Mock Objects

"Why You Don't Get Mock Objects" by Gregory Moeck

RubyConf 2011 | 2011-09-29 | Gregory Moeck (@gregmoeck)

  • Recommended as the best book on mocks: Growing Object-Oriented Software, Guided by Tests by Steve Freeman & Nat Pryce
  • Common arguments against mocks
    • They duplicate implementation
    • They lead to brittle tests
  • Mock objects + procedural programming = bad idea
  • If you're doing traditional Rails development (which tends to follow more of a "procedural", do-this-and-then-do-that style), mock objects probably aren't for you
@sl4m
sl4m / gist:1470360
Created December 13, 2011 03:18 — forked from emboss/gist:1470287
Encode pre-1.9.3 RSA public keys using X.509 format
require 'openssl'
require 'base64'
rsa = OpenSSL::PKey::RSA.new(2048)
modulus = rsa.n
exponent = rsa.e
oid = OpenSSL::ASN1::ObjectId.new("rsaEncryption")
alg_id = OpenSSL::ASN1::Sequence.new([oid, OpenSSL::ASN1::Null.new(nil)])
ary = [OpenSSL::ASN1::Integer.new(modulus), OpenSSL::ASN1::Integer.new(exponent)]
@sl4m
sl4m / Custom.less
Created October 5, 2012 00:24 — forked from bentruyman/Custom.less
Tomorrow Theme for Chrome Developer Tools
/**********************************************/
/*
/* Tomorrow Skin by Ben Truyman - 2012
/*
/* Based on Chris Kempson's Tomorrow Theme:
/* https://github.com/ChrisKempson/Tomorrow-Theme
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@sl4m
sl4m / gist:5091803
Created March 5, 2013 16:57 — forked from trcarden/gist:3295935
create self-signed certificate for localhost
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key