Skip to content

Instantly share code, notes, and snippets.

View vangberg's full-sized avatar

Harry Vangberg vangberg

View GitHub Profile
@vangberg
vangberg / DWM-ON-OS-X.md
Created February 22, 2010 19:24
dwm on os x [work in progress!]

Installing and configuring dwm on OS X

  1. Install XQuartz (http://xquartz.macosforge.org) which is the development version of the X11.app that ships with OS X, which means it is way more up to date. I have had some weird issues with X11.app v. 2.3-something. XQuartz 2.5.0 fixed that.

  2. Install dwm from Homebrew, brew install dwm. This makes a bunch of necessary tweaks to the DWM configuration.

  3. Add the following script to $PATH, name it dwm-launch and chmod 755:

    cd ~
    

while true

@vangberg
vangberg / app.rb
Created May 30, 2009 15:00
minimal sinatra rackup
require 'sinatra'
get '/' do
"Hello world"
end
@vangberg
vangberg / curb.rb
Created December 14, 2010 20:10
persistent http w/ ruby
require "curb"
# Persistent.
c = Curl::Easy.new
c.url = "http://127.0.0.1"
2.times { c.perform }
# Not persistent.
2.times {
c = Curl::Easy.new
@vangberg
vangberg / README
Created February 22, 2009 01:06
Deploying a Sinatra app to Heroku
# Deploying a Sinatra app to Heroku
## Database
The location of the database Heroku provides can be found in the environment
variable DATABASE_URL. Check the configure-block of toodeloo.rb for an example
on how to use this.
## Server
Heroku is serving your apps with thin, with means you have all your thin goodness available,
such as EventMachine.
@vangberg
vangberg / todo
Created September 7, 2008 19:37
Best To-Do List. Ever.
#!/bin/sh
# Best To-Do List. Ever.
#
# Usage:
# 1. Add a new item to list: `todo This needs to be fixed`
# 2. Edit the to-do list: `todo -e`
# 3. Show the current to-do's: `todo`
if [[ $1 ]]; then
if [ $1 = "-e" ]; then
import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
/* ACTIONS */
export const ADD = 'something_clever/ADD'
export function add () {
return { type: ADD }
}
# config/boot.rb
if ENV["MANUAL_GC"].to_i == 1
GC.disable
Thread.new {
while true
sleep 2
GC.enable
GC.start
GC.disable
end
<html>
<head>
<script src="jquery-1.8.3.js"></script>
<script src="jquery.tmpl.min.js"></script>
<script src="knockout-2.2.0.js"></script>
</head>
<body>
<input data-bind='value: users()[0].name' />
<h2>Good</h2>
require "sequel"
db = Sequel.sqlite
db.create_table :items do
primary_key :id
String :file
end
set = db[:items]
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
$ rails -v
Rails 3.2.6
$ mkdir memory_leak
$ cd memory_leak
$ rails new .
$ rails g model Stub
$ bundle exec rake db:create db:migrate
$ rails runner ml.rb