Skip to content

Instantly share code, notes, and snippets.

View mrb's full-sized avatar
🍕
Helping companies market and sell more software

Michael Bernstein mrb

🍕
Helping companies market and sell more software
View GitHub Profile
@mrb
mrb / breadboard.clj
Last active August 29, 2015 13:57 — forked from jrecursive/gist:9668987
(create-circuit :test)
(create-channel :tweets)
(create-device :tweeter-1 as :tweeter
(filters ["ukraine" "russia" "putin" "news" "crimea"]))
(create-device :tweet-channel as :channeler
(channel :tweets))
(create-wire->
module FizzBuzzC
%default total
-- Dependently typed FizzBuzz, constructively
-- A number is fizzy if it is evenly divisible by 3
data Fizzy : Nat -> Type where
ZeroFizzy : Fizzy 0
Fizz : Fizzy n -> Fizzy (3 + n)
@mrb
mrb / snippet.rb
Created December 17, 2008 16:29 — forked from quirkey/snippet.rb
module ActionView
module Helpers
class InstanceTag
def to_check_box_tag(options = {}, checked_value = "1", unchecked_value = "0")
options = options.stringify_keys
options["type"] = "checkbox"
options["value"] = checked_value
if options.has_key?("checked")
cv = options.delete "checked"
checked = cv == true || cv == "checked"
@mrb
mrb / way 1.js
Created April 26, 2009 21:13 — forked from quirkey/way 1.js
var Favorite = {
client_name: "",
client_id: "",
user_id: "",
add_or_remove: "",
getID: function(params){
this.client_name = params.attr("client_name");
this.client_id = params.attr("client_id");
this.user_id = params.attr("user_id");
@mrb
mrb / snippet.txt
Created September 24, 2009 20:15 — forked from quirkey/snippet.txt
class B
def self.method_missing(m, *args)
puts "B#{m.to_s.upcase}"
end
end
class B
def self.oosh
puts 1.to_f/0
end
@mrb
mrb / searchable.rb
Created August 23, 2010 18:15 — forked from quirkey/snippet.txt
module Searchable
def self.searchable_fields
[]
end
def self.included(klass)
klass.named_scope :by_search, lambda {|q, options|
if q.present?
search_text = [klass.searchable_fields].flatten.collect {|f|
@mrb
mrb / lol
Created September 3, 2010 01:24 — forked from quirkey/lol
#!/usr/bin/env ruby
require 'open-uri'
category = ARGV[0] || 'fail'
url = "http://api.cheezburger.com/xml/category/#{category}/lol/random"
open(url) do |f|
xml = f.read
if xml =~ /LolImageUrl\>([^\<]*)/m
@mrb
mrb / sexy_yoga_time.md
Created October 25, 2011 16:52
Sexy Yoga Time!

Yoga Time!

Madison Ruby Conf Stretches

In Chair

  1. extend one arm forward, flex hand up(like stop sign), use other hands to pull fingers back toward body. then flex hand down and pull fingers toward body. do both sides
@mrb
mrb / fizzbuzz.rb
Created August 1, 2012 21:18 — forked from JEG2/fizzbuzz.rb
Writing FizzBuzz without modulus division
fizz = [nil, nil, "Fizz"].cycle.take(100)
buzz = [nil, nil, nil, nil, "Buzz"].cycle.take(100)
numbers = 1..100
numbers.zip(fizz, buzz) do |n, f, b|
fizzbuzz = [f, b].join
puts(fizzbuzz.empty? ? n : fizzbuzz)
end
(defn sumo
([l n] (sumo l 0 n))
([l acc n]
(matche [l]
([[]] (fd/== acc n))
([[x . r]]
(fresh [nacc]
(fd/in x (fd/interval 0 1))
(fd/+ acc x nacc)
(sumo r nacc n))))))