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
# | |
# Mirah REPL -- hacked to bits | |
# | |
# assuming your ruby is jruby, | |
# $ gem install mirah | |
# $ ruby -rubygems repl.rb | |
# m> class Foo | |
# m> def bar | |
# m> 12 | |
# m> 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
var fs = require('fs'), | |
spdy = require('spdy'), | |
httpProxy = require('http-proxy'); | |
var options = { | |
key: fs.readFileSync(__dirname + '/moderation-key.pem'), | |
cert: fs.readFileSync(__dirname + '/moderation-cert.pem'), | |
ca: fs.readFileSync(__dirname + '/moderation-csr.pem') | |
}; |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
# Additional methods for Goliath::TestHelper to make simple Goliath testing | |
# simple. You might need the other syntax for testing gnarly stuff, but I've | |
# yet to need it. To use, just include this in your spec_helper.rb. | |
# | |
# Your spec must respond to #api and return the Goliath API class to test. | |
# | |
# @example | |
# describe MyAPI do | |
# let(:api) { MyAPI } | |
# describe "GET /" 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
import com.cloudera.crunch._ | |
import com.cloudera.scrunch._ | |
class ScrunchWordCount { | |
def wordCount(inputFile: String, outputFile: String) = { | |
val pipeline = new Pipeline[ScrunchWordCount] | |
pipeline.read(from.textFile(inputFile)) | |
.flatMap(_.toLowerCase.split("\\W+")) | |
.filter(!_.isEmpty()) | |
.count |
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
" Name: focus.vim | |
" Author: Alan MacDougall <smoke@alanmacdougall.com> | |
" License: Public Domain | |
" | |
" Focus on a single column of text, showing it in a distraction-free format. | |
" Save this as ~/.vim/scripts/focus.vim (or whatever you please), and invoke | |
" it with :source <filename>. Of course, you could certainly hook that up to a | |
" :command, or a macro, or a Vimscript function... | |
" collapse current splits and divide screen in three |
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
# Adapted from https://github.com/kilim/kilim/blob/master/examples/kilim/examples/SimpleTask.java | |
import "kilim.Mailbox" | |
import "kilim.Pausable" | |
import "kilim.Task" | |
class ExampleTask < Task | |
def initialize | |
@mailbox = Mailbox.new | |
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
# Ruby 1.9.3 | |
ruby-1.9.3-p0 ~/projects/jruby $ ruby -v bench/bench_fiber_ring.rb 5 100 1000 | |
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0] | |
bench/bench_fiber_ring.rb:23: warning: mismatched indentations at 'end' with 'def' at 21 | |
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.155022) | |
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.153985) | |
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.153822) | |
100 fibers / 1000 passes: 0.150000 0.000000 0.150000 ( 0.152370) | |
100 fibers / 1000 passes: 0.160000 0.000000 0.160000 ( 0.155857) |
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 'jruby' | |
module Serialize | |
def self.serialize(obj) | |
baos = java.io.ByteArrayOutputStream.new | |
oos = java.io.ObjectOutputStream.new(baos) | |
oos.write_object(JRuby.reference(obj)) | |
oos.close | |
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 cache dir | |
proxy_cache_path /var/cache/nginx levels=1:2 | |
keys_zone=microcache:5m max_size=1000m; | |
# Virtualhost/server configuration | |
server { | |
listen 80; | |
server_name yourhost.domain.com; | |
# Define cached location (may not be whole site) |