Skip to content

Instantly share code, notes, and snippets.

View saml's full-sized avatar

Sam Lee saml

  • New York, NY
View GitHub Profile
@saml
saml / maybefold.hs
Created January 9, 2013 22:21
lends stuff
import Control.Lens
import Control.Monad.State
import Data.Foldable (mapM_)
data Rec =
Rec { _recA :: Int, _recB :: String, _recC :: Double }
deriving (Eq, Ord, Show)
makeLenses Rec
a = Just 1
@saml
saml / rate.js
Last active December 11, 2015 02:58
(function() {
var format = /^(.+)<a href=.+<span>(.+)<\/span>$/;
var scores = {};
var rates = {};
var secs = 10;
jQuery('body').append('<div id="saml-rates"></div>');
var output = jQuery('#saml-rates');
var getProcessor = function(el) {
return function() {
@saml
saml / webscale.gridlang
Created January 15, 2013 03:59
webscale gridlang
# web scale stuff
@loop
# look south
CALLFF << @LOOK @SOUTH 2
# is robot on south?
EQUAL << @CELL_ROBOT
# then punch it.
IFTGOTO << @punchsouth
@saml
saml / yolo.gridc
Last active December 11, 2015 03:38
yolo gridlang
int s;
int e;
int n;
int w;
int direction;
int
go() {
return ffi(@move, direction);
@saml
saml / blog test.md
Last active December 11, 2015 05:58

This is test entry

whatever this is code

hello

and this is some code:

x = [x for x in x]
for x in x:
 print(x)

안녕 some unicode is here.

hello
int main() {
  return 0;
}
$ sudo cat /etc/postgresql/9.1/main/pg_hba.conf |grep -v '^#'
local all postgres peer
local all all peer
@saml
saml / httpd.conf
Created January 29, 2013 21:43
enable ssi on proxy
NameVirtualHost *:8383
<VirtualHost *:8383>
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
<Proxy http://localhost:5000/*>
Order deny,allow
Allow from all
SetOutputFilter INCLUDES
</Proxy>
</VirtualHost>
@saml
saml / slugify.bash
Created January 30, 2013 17:36
make slug out of title. slugify.bash 'Surface to Air: The Brand Givenchy and Vuitton Hire to Stay Cool' 24
#!/bin/bash
title="$1"
max_length="${2:-48}"
slug="$({
tr '[A-Z]' '[a-z]' | tr -cs '[[:alnum:]]' '-'
} <<< "$title")"
slug="${slug##-}"
slug="${slug%%-}"
slug="${slug:0:$max_length}"
foobar hello
foobaryolo hels fa
==>
foobar hello
foobaryolo hels fa