Skip to content

Instantly share code, notes, and snippets.

@JakubOboza
JakubOboza / example.js
Created January 18, 2012 15:50
map over heavy tasks to not block event loop
mapHeavy([1,2,3,4,5,6], function(e){setTimeout(function(){console.log(e);}, 1000);});
mapHeavy([10,20,30,40,50,60], function(e){setTimeout(function(){console.log(e);}, 500);});
@JakubOboza
JakubOboza / 0_README.md
Created January 18, 2012 11:13 — forked from netzpirat/0_README.md
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard
proxy_cache_path /var/www/cache levels=1:2 keys_zone=my-test-cache:8m max_size=5000m inactive=300m;
server {
location / {
proxy_pass http://127.0.0.1:3000;
proxy_cache my-test-cache;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;
}
}
@JakubOboza
JakubOboza / installing-ghc7.2-osx10.7.md
Created December 10, 2011 12:14 — forked from beastaugh/installing-ghc7.2-osx10.7.md
Installing GHC 7.2 on Mac OS X 10.7 Lion

Installing GHC 7.2 on Mac OS X

This is a brief and bare-bones guide to getting GHC 7.2 and the cabal-install tool (the two basic things you'll need to do Haskell development) up and running on a new Mac OS X 10.7 install.

The instructions given here worked for me, but YMMV.

@JakubOboza
JakubOboza / gist:1454977
Created December 10, 2011 11:48
Node.js File Upload
// from : http://www.componentix.com/blog/9/file-uploads-using-nodejs-now-for-real
var http = require("http");
var url = require("url");
var multipart = require("multipart");
var sys = require("sys");
var events = require("events");
var posix = require("posix");
var server = http.createServer(function(req, res) {
@JakubOboza
JakubOboza / Gemfile
Created November 26, 2011 22:35
facebook authentication with Rails 3.1 and OmniAuth 1.0 and Devise 1.5
gem 'devise', '1.5.0'
gem 'omniauth-facebook', :git => "git://github.com/mkdynamic/omniauth-facebook.git"
gem 'rspec-rails', :group => [:development, :test]
group :test do
# Pretty printed test output
gem 'turn', '< 0.8.3', :require => false
gem 'cucumber-rails'
gem 'capybara'
@JakubOboza
JakubOboza / mongoid_tags.rb
Created November 22, 2011 15:04
tags formongoid collections.
module Mongoid
module Document
module Taggable
def self.included(base)
base.class_eval do |base_document|
base_document.field :tags, :type => Array, :default => []
base_document.index :tags
include InstanceMethods
extend ClassMethods
@JakubOboza
JakubOboza / gist:1382286
Created November 21, 2011 10:44
syntax fail
return{
ok: false
};
return
{
ok: false
};
@JakubOboza
JakubOboza / gist:1369897
Created November 16, 2011 11:42
ocnvert.sh
#!/bin/sh
if [ $# -ne 2 ]; then
echo "Usage: $0 url output-pdf-file"
exit 1
fi
set -e
documenturl="$(echo -n "$1" | xxd -plain | tr -d '\n' | sed 's/\(..\)/%\1/g')"
viewerurl="http://docs.google.com/viewer?url=$documenturl"
@JakubOboza
JakubOboza / fib.ml
Created November 9, 2011 22:47
Syntax in Ocaml
Printf.printf "Hello out there\n%!";;
let rec fibonacci n = if n < 3 then 1 else fibonacci (n-1) + fibonacci (n-2);;
Printf.printf "Please enter an integer number: %!";;
let n = read_int ()
in Printf.printf "The %d'th Fibonacci number is %d\n%!" n (fibonacci n);;
(* run it by "ocaml fib.ml" or compile "ocamlopt -o fib fib.ml"*)