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
:set -i.:config:dist/build/autogen | |
:set -XCPP -XTemplateHaskell -XQuasiQuotes -XTypeFamilies -XFlexibleContexts -XGADTs -XOverloadedStrings -XMultiParamTypeClasses -XGeneralizedNewtypeDeriving -XEmptyDataDecls -XDeriveDataTypeable | |
import Prelude | |
import Control.Applicative | |
import Data.Char | |
import Data.List | |
import qualified Data.Text as T | |
import Data.Text (Text) |
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
def self.cached_method(meth) | |
eval <<-CODE | |
def #{meth}_with_cache | |
return @#{meth} if @#{meth} | |
result = #{meth}_without_cache | |
@#{meth} ||= result | |
end | |
CODE | |
alias_method_chain meth, :cache | |
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
# Add this to more_web_steps.rb | |
# Selenium docs: http://code.google.com/p/selenium/wiki/RubyBindings#Javascript_Alert/Confirm today! | |
When /^I (accept|dismiss) the "([^"]*)" alert$/ do |action, text| | |
alert = page.driver.browser.switch_to.alert | |
alert.text.should eq(text) | |
alert.send(action) | |
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
require 'goliath' | |
require 'http_router' | |
# https://github.com/joshbuddy/http_router | |
HttpRouter::Rack.override_rack_builder! | |
class RackRoutes < Goliath::API | |
map('/get/:id') do |env| | |
[200, {'Content-type' => 'text/plain'}, ["My id is #{env['router.params'][:id]}\n"]] | |
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 Barrier < EM::Synchrony::Multi | |
attr_accessor :env, :status, :headers, :body | |
def initialize env | |
super() | |
@env = env | |
@acb = env['async.callback'] | |
env['async.callback'] = self | |
callback do |
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
#!/usr/bin/env ruby | |
$: << File.join(File.dirname(__FILE__), '../lib') | |
require 'goliath' | |
require 'em-mongo' | |
require 'em-http' | |
require 'em-synchrony/em-http' | |
require 'yajl/json_gem' | |
require 'goliath/synchrony/mongo_receiver' # has the aroundware logic for talking to mongodb | |
require File.join(File.dirname(__FILE__), 'auth_receiver') |
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
// Allows you to specify events on the data tied to the view in the same way | |
// that you can specify dom events: | |
// | |
// dataEvents: { | |
// instanceName: { | |
// 'change:name': 'mothed', | |
// delete: 'otherMethod' | |
// }, ... | |
// } | |
registerDataEvents: function(unbind) { |
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/bash | |
SANDBOX_DIR="cabal-dev" | |
SDIST_DIR="./sdist/" | |
SDIST_SUFFIX=".tar.gz" | |
PACKAGES_CONF_DIR=$SANDBOX_DIR"/packages-"`ghc --numeric-version`".conf/" | |
find $SDIST_DIR -name *$SDIST_SUFFIX -print0 | while read -d $'\0' sdist_path | |
do |
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
{-# LANGUAGE | |
GADTs | |
, KindSignatures | |
, DataKinds | |
, PolyKinds | |
, TypeOperators | |
, TypeFamilies | |
, MultiParamTypeClasses | |
, FlexibleInstances | |
, UndecidableInstances |
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/bash -e | |
name=$(sed -n -e 's/^[nN]ame:\s\+\(.\+\)/\1/p' *.cabal) | |
old_ver=$(sed -n -e 's/^[vV]ersion:\s\+\(.\+\)/\1/p' *.cabal) | |
has_docs=1 | |
grep -i '^Library' *.cabal || has_docs=0 | |
echo "Package name: $name" | |
echo "Current version: $old_ver" | |
echo "Has documentation: $has_docs" |
OlderNewer