Skip to content

Instantly share code, notes, and snippets.

@rlb3
rlb3 / gcd.m
Created May 16, 2011 19:17 — forked from chrishulbert/gcd.m
Tricks with grand central dispatch
// Using grand central dispatch (GCD) so we don't block the GUI
dispatch_async(dispatch_get_global_queue(0, 0), ^{
// Background, long stuff runs here, but doesn't affect the GUI
dispatch_async(dispatch_get_main_queue(), ^{
// The GUI thread stuff goes here
[self.tableView reloadData]; // example
@rlb3
rlb3 / emacs-pipe.pl
Created August 12, 2011 23:18 — forked from aufflick/emacs-pipe.pl
Piping to an emacs buffer with emacsclient
#!/usr/bin/env perl
# You can use this script in a pipe. It's input will become an emacs buffer
# via emacsclient (so you need server-start etc.)
# See http://mark.aufflick.com/o/886457 for more information
# Copyright (C) 2011 by Mark Aufflick <mark@aufflick.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@rlb3
rlb3 / opml2org.pl
Created January 5, 2012 15:00 — forked from alandipert/opml2org.pl
Convert OPML to org-mode style nested headings, suitable for Confluence or Emacs
#!/usr/bin/perl
# Usage: perl opml2org.pl "My OPML File.opml"
use XML::Parser;
binmode STDOUT, ":utf8";
$xp = new XML::Parser();
$xp->setHandlers(Start => \&start, End => \&end);
$xp->parsefile($ARGV[0]);
$indent = 0;
@rlb3
rlb3 / ns-cheatsheet.clj
Created March 9, 2012 13:37 — forked from ghoseb/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix.
;;
;; * :use makes functions available without a namespace prefix
;; (i.e., refers functions to the current namespace).
;;
;; * :import refers Java classes to the current namespace.
;;
@rlb3
rlb3 / 0. nginx_setup.sh
Created August 11, 2012 18:37 — forked from mikhailov/0. nginx_setup.sh
Nginx+Unicorn
# Nginx+Unicorn best-practices congifuration guide.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@rlb3
rlb3 / disable_framework.md
Created October 17, 2012 12:19 — forked from guilleiguaran/disable_framework.md
Disabling frameworks in Rails 3+

Disabling frameworks in Rails 3+###

Replace in your config/application.rb

require "rails/all"

with:

require "rails"
@rlb3
rlb3 / friend.rb
Created November 14, 2012 15:10 — forked from codeodor/friend.rb
Friend functions in Ruby
# See http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-set_trace_func for docs on this function
require 'ostruct'
module Friendly
def self.included(base)
base.extend(ClassMethods)
end
def method_missing(name, *args, &block)
@rlb3
rlb3 / init.el
Created December 6, 2012 18:47 — forked from mig/init.el
Simple Emacs 24 configuration for Rails development
;; emacs configuration
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(unless (require 'el-get nil 'noerror)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.github.com/dimitri/el-get/master/el-get-install.el")
(let (el-get-master-branch)
(goto-char (point-max))
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")