Skip to content

Instantly share code, notes, and snippets.

View mwotton's full-sized avatar

Mark Wotton mwotton

View GitHub Profile
@mwotton
mwotton / gist:1212984
Created September 13, 2011 02:08
slaved
def slaved(processes)
pids = []
processes.times do
res=Kernel.fork
if res
pids << res
else
yield
exit 0
def magic()
raise "not defined"
end
def foobar(bar, baz)
"#{bar} is definitely not a #{baz}"
end
def quux(bar, baz, bahooey)
"Whereas #{bar} and #{baz} might be #{bahooey}"
@mwotton
mwotton / gist:1223533
Created September 17, 2011 01:58
ghc 7.2.1 crash
sleipnir ➜ ~ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.2.1
sleipnir ➜ ~ ghc --make foo.hs -shared
[1 of 1] Compiling Main ( foo.hs, foo.o )
Linking foo ...
collect2: ld terminated with signal 11 [Segmentation fault]
sleipnir ➜ ~ cat foo.hs
main = putStrLn "hi"
@mwotton
mwotton / gist:1238970
Created September 24, 2011 04:30
yesod util function
orFail action = do res <- action
case res of
Just j -> return j
Nothing -> invalidArgs ["something went wrong"]
@mwotton
mwotton / test.hs
Created October 3, 2011 11:02
test
{-# LANGUAGE OverloadedStrings #-}
import Lengthable
import Prelude hiding (length)
import qualified Data.Text
import Data.Text(Text(..))
text :: Text
text = "abcdefg"
main = do print $ length [1,2,3]
@mwotton
mwotton / gist:1350517
Created November 9, 2011 05:35 — forked from nicholasf/gist:1350482
Seeking feedback before I post this
How to calculate an hourly rate.
Hi,
I've been watching job boards for Ruby related contracts lately and have noticed some low rates being offered with high expectations. It's happening frequently enough that I wanted to post my understanding of how to calculate an hourly rate. Setting *reasonable* standards of pay for the appropriate level of expertise is vital. There's a lot to say on the matter, so I've tried to be brief.
For some reason it's very easy for software developers to match their experience and knowledge to a full-time rate, but for contracting there is less awareness.
The difference between full-time employment and self employment.
sqlite> SELECT * FROM blocks;
id|name|guid|last_ip|created_at|updated_at|pubkey|user_id
34|||127.0.0.1|2012-01-02 08:17:14.595101|2012-01-02 08:17:14.595101|foobar|
sqlite> select * from blocks where last_ip='127.0.0.1';
sqlite> select * from blocks where pubkey='foobar';
id|name|guid|last_ip|created_at|updated_at|pubkey|user_id
34|||127.0.0.1|2012-01-02 08:17:14.595101|2012-01-02 08:17:14.595101|foobar|
and
=begin
<% @form.form_fields.each do |field| %>
<div>
<%= f.label field.name, field.label, :class => 'rectifier', %>
<% puts({:foo => field}.inspect) %>
<%= display_form_field(f, field) %>
</div>
<% end %>
=end
has_one :trigger_submission, {
:as => :submitter,
:dependent => :nullify,
:class_name => 'FormSubmission'
}
has_one :action_submission, {
:as => :submitter,
:dependent => :nullify,
:class_name => 'FormSubmission'
}
children :: MVar [MVar ()]
children = unsafePerformIO (newMVar [])
waitForChildren :: IO ()
waitForChildren = do
cs <- takeMVar children
case cs of
[] -> return ()
m:ms -> do
putMVar children ms