This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
account default | |
host mail.messagingengine.com | |
port 587 | |
protocol smtp | |
auth on | |
from mike@mike-burns.com | |
user mikeburns@fastmail.fm | |
password topsecretpassword! | |
tls on | |
tls_nocertcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InputOutput | |
def initialize(&action) | |
@action = action | |
end | |
private_class_method :new | |
# return :: (Monad m) => a -> m a | |
def self.unit(x) | |
new { x } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThingyMaker(object): | |
def __init__(self): | |
self.thingy = None | |
self.widget = None | |
def with_thingy(self, thingy): | |
self.thingy = thingy | |
return self | |
def with_widget(self, widget): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Io | |
attr_reader :action | |
def initialize(&action) | |
@action = action | |
end | |
def bind(&f) | |
Io.new do | |
result = @action.call | |
f.call(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Monoid | |
attr_accessor :value | |
def initialize(value) | |
@value = value | |
end | |
def self.base | |
new(const_get(:BASE)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
entry_text=`pwd` | |
location=`zenity --file-selection --directory --filename=$entry_text --title="Open location"` | |
if [ "x$?" = "x0" ]; then | |
xdg-open "$location" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module IsFibber | |
def fibonacci?(n) | |
perfect_square?(5 * n * n + 4) || perfect_square?(5 * n * n - 4) | |
end | |
private | |
def perfect_square?(f) | |
sqrt = Math.sqrt(f) | |
sqrt == sqrt.round |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
desktop=`xdotool get_desktop` | |
window=`xdotool search --onlyvisible --all --desktop $desktop --class gnome-terminal | head -1` | |
xdotool windowactivate --sync $window type "$@ | |
" | |
xdotool windowactivate --sync $window key Return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Literal < Struct.new(:number) | |
def show | |
print number | |
end | |
end | |
class Add < Struct.new(:a, :b) | |
def show | |
a.show | |
print ' + ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < Params.over(:first_name, :last_name) | |
def info | |
"I am a user: #{@first_name} #{@last_name}" | |
end | |
end | |
class Admin < User.params(:awesomeness_level) | |
def info | |
"I am a level #{@awesomeness_level} admin: #{@first_name} #{@last_name}" | |
end |
NewerOlder