This file contains hidden or 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
| def slaved(processes) | |
| pids = [] | |
| processes.times do | |
| res=Kernel.fork | |
| if res | |
| pids << res | |
| else | |
| yield | |
| exit 0 |
This file contains hidden or 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
| 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}" |
This file contains hidden or 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
| 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" |
This file contains hidden or 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
| orFail action = do res <- action | |
| case res of | |
| Just j -> return j | |
| Nothing -> invalidArgs ["something went wrong"] |
This file contains hidden or 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
| {-# 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] |
This file contains hidden or 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
| 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. |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| =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 |
This file contains hidden or 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
| has_one :trigger_submission, { | |
| :as => :submitter, | |
| :dependent => :nullify, | |
| :class_name => 'FormSubmission' | |
| } | |
| has_one :action_submission, { | |
| :as => :submitter, | |
| :dependent => :nullify, | |
| :class_name => 'FormSubmission' | |
| } |
This file contains hidden or 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
| children :: MVar [MVar ()] | |
| children = unsafePerformIO (newMVar []) | |
| waitForChildren :: IO () | |
| waitForChildren = do | |
| cs <- takeMVar children | |
| case cs of | |
| [] -> return () | |
| m:ms -> do | |
| putMVar children ms |