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
<?php | |
define('MESSAGE_POLL_MICROSECONDS', 500000); | |
define('MESSAGE_TIMEOUT_SECONDS', 60); | |
define('MESSAGE_TIMEOUT_SECONDS_BUFFER', 5); | |
class Comet { | |
public $work; | |
public $callback; | |
public static function &init($work, $callback) { |
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
==> Downloading http://www.haskell.org/ghc/dist/7.8.1-rc2/ghc-7.8.0.20140228-src.tar.bz2 | |
######################################################################## 100.0% | |
==> Downloading https://www.haskell.org/ghc/dist/7.8.1-rc2/ghc-7.8.0.20140228-x86_64-apple-darwin-lion.tar.bz2 | |
######################################################################## 100.0% | |
==> ./configure --prefix=/private/tmp/ghc-khpP/ghc-7.8.0.20140228/subfo --with-gcc=clang | |
==> make -j1 install | |
==> ./configure --prefix=/usr/local/Cellar/ghc/7.8.0.20140228 --build=x86_64-apple-darwin --with-gcc=clang | |
==> make | |
libraries/Cabal/Cabal/Distribution/Version.hs:700:19: | |
Parse error in pattern: Parse.skipSpaces |
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
#!/usr/bin/env ruby | |
require 'json' | |
require 'time' | |
data = [] | |
counts = Hash.new(0) | |
uniq_paths = [] | |
time_series = Hash.new do |h,k| | |
h[k] = Hash.new(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
-- | | |
module Main where | |
import Control.Monad.State | |
data Closure i o = R (i -> (o, Closure i o)) | |
data Mark = X | O deriving (Show, Read, Ord) | |
instance Eq Mark where | |
X == X = True | |
O == O = True |
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
module AlaCarte where | |
-- Control.Monad.Free | |
data Free f a = Free (f (Free f a)) | Pure a | |
instance Functor f => Monad (Free f) where | |
Pure a >>= f = f a | |
Free r >>= f = Free (fmap (>>= f) r) | |
return = Pure |
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
class CreatePlaces < ActiveRecord::Migration | |
# Rails migration for GeoWorldMap db into postgresql db | |
#(inspired by http://blog.inspired.no/populate-your-database-with-free-world-cities-countries-regions-in-2-minutes-using-a-rails-migration-273/ post) | |
#extract files from GeoWorldMap.zip archive from here | |
# http://www.geobytes.com/GeoWorldMap.zip | |
# | |
#and place them into #{Rails.root}/db/migrate/ | |
##the archive has 'cities.txt' file, rename it 'Cities.txt' | |
#mv cities.txt Cities.txt |
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 ScopedTypeVariables #-} | |
module Data.Time.ISO8601.Duration where | |
import Control.Applicative | |
import Data.ByteString (ByteString) | |
import qualified Data.ByteString.Char8 as BS8 | |
import Data.Attoparsec.ByteString.Char8 | |
import Test.QuickCheck |
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
import Control.Concurrent (threadDelay) | |
import Test.Hspec | |
import qualified Test.Hspec.Core.Hooks as Hooks | |
main :: IO () | |
main = hspec spec | |
-- | When a hook is set up with `beforeAll`, that changes the type |
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
require 'httparty' | |
require 'json' | |
class QueueInspector | |
include HTTParty | |
basic_auth "guest", "guest" | |
base_uri "http://192.168.0.1:55672" | |
def messages | |
body = {'count' => 5,'requeue' => true, 'encoding' => 'auto', 'truncate' => 50000}.to_json |
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
class Accommodation < ActiveResource::Base | |
class << self | |
def element_path(id, prefix_options = {}, query_options = nil) | |
prefix_options, query_options = split_options(prefix_options) if query_options.nil? | |
"#{prefix(prefix_options)}#{collection_name}/#{id}#{query_string(query_options)}" | |
end | |
def collection_path(prefix_options = {}, query_options = nil) | |
prefix_options, query_options = split_options(prefix_options) if query_options.nil? | |
"#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}" |
OlderNewer