Skip to content

Instantly share code, notes, and snippets.

View mark's full-sized avatar
💭
Smoove

Mark Josef mark

💭
Smoove
View GitHub Profile
@mark
mark / def.shard.rb
Last active August 31, 2015 12:24 — forked from zobar/def.shard.rb
Nested function definitions are a bad idea in Ruby.
#!/usr/bin/env ruby -w
def defit
def ohai
puts "hello from #{self.class.inspect} #{self.inspect}"
end
puts "called defit in #{self.class.inspect} #{self.inspect}"
end
(ns look-and-say)
(defn- consecutive [string]
(map first (re-seq #"(.)\1*" string)))
(defn- say [chars]
[(count chars) (first chars)])
(defn- get-next [string]
(apply str (mapcat say (consecutive string))))
@mark
mark / memstats.rb
Created October 18, 2013 15:52 — forked from kenn/memstats.rb
#!/usr/bin/env ruby
#------------------------------------------------------------------------------
# Aggregate Print useful information from /proc/[pid]/smaps
#
# pss - Roughly the amount of memory that is "really" being used by the pid
# swap - Amount of swap this process is currently using
#
# Reference:
# http://www.mjmwired.net/kernel/Documentation/filesystems/proc.txt#361
@mark
mark / basic.shard.rb
Created October 12, 2013 02:58 — forked from shard-test/basic.shard.rb
Shard: sample shard
class Greeter
def initialize(who)
@who = who
end
def greet
puts "Hello, #{ @who }!"
end
@mark
mark / .gitignore
Created October 12, 2013 02:56 — forked from zobar/.gitignore
Option monad in Ruby
.rbenv-gemsets
@mark
mark / gist:1730601
Created February 3, 2012 15:08 — forked from anonymous/gist:1730590
git config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:cpi2.git
[branch "master"]
remote = origin
@mark
mark / gist:1265415
Created October 5, 2011 19:31 — forked from zobar/gist:1265410
select:
applicants:
- cas_id
- last_name
- first_name
designations:
- date_locked
statuses:
- name
join: