Skip to content

Instantly share code, notes, and snippets.

View haf's full-sized avatar
💹
currently succeeding...

Henrik Feldt haf

💹
currently succeeding...
View GitHub Profile
@englishm
englishm / bootstrap.sh
Created September 4, 2012 02:29 — forked from kuleszaj/bootstrap.sh
Puppet Bootstrap, CentOS
#!/bin/bash
# Update our package manager...
sudo yum check-update -y
# Install dependencies for RVM and Ruby...
sudo yum -y install gcc-c++ patch readline readline-devel zlib zlib-devel libxml2-devel libyaml-devel libxslt-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel git
# Get and install RVM
curl -L https://get.rvm.io | sudo bash -s stable
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@botimer
botimer / yesno.rb
Created June 7, 2012 19:56
Handy yes/no prompt for little ruby scripts
# This is a reasonably well-behaved helper for command-line scripts needing to ask a simple yes/no question.
# It optionally accepts a prompt and a default answer that will be returned on enter keypress.
# It keeps asking and echoes the answer on the same line until it gets y/n/Y/N or enter.
# I tried to get Highline to behave like this directly, but even though it's sophisticated, I didn't like the result.
# This isn't especially elegant, but it is straightforward and gets the job done.
require 'highline/import'
def yesno(prompt = 'Continue?', default = true)
a = ''
s = default ? '[Y/n]' : '[y/N]'
<!DOCTYPE html>
<head>
<style type="text/css">
.saved { border: 3px solid green; }
.unsaved { border: 3px solid red; }
</style>
<script src="jquery-1.7.2.min.js"></script>
<script src="rx.js"></script>
<script src="rx.time.js"></script>
<script src="rx.jquery.js"></script>
@phatboyg
phatboyg / ActorBehaviorExample.cs
Created November 28, 2011 22:59
Example of applying behavior to an actor
class Cleaner_version_of_defining_actor_behavior
{
public void Some_method_in_your_code()
{
// create the actor instance, passing the state and an initializer
// in this case, applying the initial behavior of to the actor
ActorRef agent = Actor.New<MyState>(x => x.Apply<DefaultBehavior>());
// now messages can be sent to the actor to make it do things
// we will use a stateless actor for that interaction
anonymous
anonymous / Ropes in F#
Created May 5, 2010 14:11
// Learn more about F# at http://fsharp.net
#light
module Module1
open System
type Rope = Rope of int * int * RopeNode
and RopeNode =
Concat of Rope * Rope
| Leaf of String