Skip to content

Instantly share code, notes, and snippets.

View lmarburger's full-sized avatar
🥖
Temporally nondeterministic

Larry Marburger lmarburger

🥖
Temporally nondeterministic
View GitHub Profile
wat : Nat -> Nat
wat (S k) = k
/*
*wat> wat 1
0 : Nat
*wat> wat 2
1 : Nat
*wat> wat 3
2 : Nat
require 'metriks/reporter/librato_metrics'
require 'socket'
prefix = ENV.fetch('LIBRATO_METRICS_PREFIX') do
ENV['RACK_ENV'] unless ENV['RACK_ENV'] == 'production'
end
app_name = ENV.fetch('DYNO') do
# Fall back to hostname if DYNO isn't set.
require 'socket'
@lmarburger
lmarburger / exercise-1-4-4.txt
Last active August 29, 2015 14:00
Introduction to Functional Programming
one x = 1
one :: α → num
apply f x = f x
f :: (α → β)
x :: α
apply :: (α → β) → α → β
compose f g x = f(g x)
f :: (α → β)
@lmarburger
lmarburger / no-idea-what-im-doing.coffee
Created March 27, 2014 13:13
I have no idea what I'm doing.
$ 'thing'
.on 'submit', (e) ->
new Spinner
length: 5
.spin()
console.log 'submit'
# // Generated by CoffeeScript 1.7.1
# $('thing').on('submit', function(e) {
# return new Spinner({
@lmarburger
lmarburger / end_exit.rb
Last active August 29, 2015 13:57
END + at_exit
at_exit { puts 'at_exit1' }
puts 1
END { puts 'end' }
BEGIN { puts 'begin' }
puts 2
at_exit { puts 'at_exit2' }
# Output:
# begin
# 1
@lmarburger
lmarburger / README.md
Last active August 29, 2015 13:56
Pipe the selection to the CoffeeScript compile and print the result.

No more wondering, "How does this compile?"

Image 2014-02-14 at 9.42.51 AM.png

Image 2014-02-14 at 9.43.08 AM.png

@lmarburger
lmarburger / jumps.rb
Last active August 29, 2015 13:56
Playing with return
def jump_proc
proc { return 42 }.call
raise "here"
end
jump_proc #=> 42
def jump_lamb
lambda { return 42 }.call
raise "here"
end
@lmarburger
lmarburger / local_jump_error.rb
Created February 10, 2014 21:20
Return value from LocalJumpError
begin
Proc.new { return 42 }.call
rescue LocalJumpError => e
puts "LocalJumpError: exit_value=#{e.exit_value}"
end
#=> "LocalJumpError: exit_value=42"
@lmarburger
lmarburger / readme.md
Created January 29, 2014 16:13
Integrating with CloudApp

AppleScript

The new Cloud.app includes basic AppleScripting support to upload files and text and create bookmarks. This is a work in progress. If theres's something you'd like to do, please get in touch.

Upload

The upload command supports a file or text. If you send a file object, it uploads the file at the path. If you send text, it uploads the text as a new

@lmarburger
lmarburger / enumerable_queue.rb
Last active December 28, 2015 08:29
Fun with queues and threads
require 'thread'
class EnumerableQueue
attr_reader :jobs, :poison, :finished_lock, :finished, :pool_size
def initialize(pool_size = 1)
@jobs = Queue.new
@results = Queue.new
@poison = Object.new
@finished_lock = Mutex.new