Skip to content

Instantly share code, notes, and snippets.

View strax's full-sized avatar

Sami Kukkonen strax

View GitHub Profile
gem "mongoid", ">= 2.0.0.beta9"
gem "bson_ext", ">= 1.0.3"
gem "haml", ">= 3.0.12"
gem "rspec-rails", ">= 2.0.0.beta.15", :group => :test
generators = <<-GENERATORS
config.generators do |g|
g.orm :mongoid
g.template_engine :haml
g.test_framework :rspec, :fixture => true, :views => false
var depth = 0;
function f(x, y, z) {
if(y < x) {
++depth
console.log("Recursion depth: %d", depth)
z = f(f(x - 1, y, z), f(y - 1, z, x), f(z - 1, x, y))
--depth
}
return z
var depth = 1, invocations = 0, substractions = 0, edge = 0;
function f(x, y, z) {
if(y < x) {
// Increment the counters
++depth
substractions += 3
if(depth > edge) edge = depth
console.log("Recursion depth: %d", depth)
@strax
strax / app.rb
Created March 27, 2011 12:52 — forked from nmerouze/app.rb
gem "mongoid", ">= 2.0.0.beta9"
gem "bson_ext", ">= 1.0.3"
gem "haml", ">= 3.0.12"
gem "rspec-rails", ">= 2.0.0.beta.15", :group => :test
generators = <<-GENERATORS
config.generators do |g|
g.orm :mongoid
g.template_engine :haml
g.test_framework :rspec, :fixture => true, :views => false
@strax
strax / LICENSE.txt
Created May 31, 2011 12:36 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "uv/uv.h"
static uv_tcp_t server;
void on_close(uv_handle_t* handle) {
// release the handle
free(handle);
unction $bind1_0(fn, thisObj, scope) {
return function() {
return fn.call(thisObj, scope);
}
}
function $bind1_1(fn, thisObj, scope) {
return function(arg) {
return fn.call(thisObj, scope, arg);
}
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Checkout details &mdash; Cloudchat</title>
<link href="screen.css" media="screen, projection" rel="stylesheet" type="text/css">
</head>
<body id="checkout">
<section class="dialog">
<header>
@strax
strax / index.html
Created November 6, 2011 18:01
Sample login dialog
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Login</title>
<link rel="stylesheet" type="text/css" media="screen, projection" href="screen.css">
</head>
<body>
<div class="dialog" id="new-session-dialog">
<h1>Login</h1>
(defn relay [x i]
(when (:next x)
(send (:next x) relay i))
(when (and (zero? i) (:report-queue x))
(.put (:report-queue x) i))
x)
(defn run [m n]
(let [q (new java.util.concurrent.SynchronousQueue)
hd (reduce (fn [next _] (agent {:next next}))