Skip to content

Instantly share code, notes, and snippets.

$(function() {
var source = new EventSource('/events');
source.onopen = function (event) {
console.log("eventsource connection open");
};
source.onerror = function() {
if (event.target.readyState === 0) {
console.log("reconnecting to eventsource");
} else {
console.log("eventsource error");
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.bz2
tar -xvjf ruby-1.9.3-p392.tar.bz2
cd ruby-1.9.3-p392/
./configure --prefix=/usr/local
make
make install
@febeling
febeling / gist:2604873
Created May 5, 2012 19:23
man redefined as a function for use with manservant (OS X)
function man() { open http://man.dev/$1 }
@febeling
febeling / Instrospection.m
Created February 29, 2012 23:00
objective-c instrospection
#import <objc/runtime.h>
-(void)dumpInfo
{
Class clazz = [self class];
u_int count;
Ivar* ivars = class_copyIvarList(clazz, &count);
NSMutableArray* ivarArray = [NSMutableArray arrayWithCapacity:count];
for (int i = 0; i < count ; i++)
@febeling
febeling / .gitignore
Created February 29, 2012 22:16
StatusItemPopover
xcuserdata
@febeling
febeling / .gitignore
Created February 13, 2012 11:07
Try multifile
/ExampleTypingAttributes.xcodeproj/project.xcworkspace/contents.xcworkspacedata
/ExampleTypingAttributes.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad/UserInterfaceState.xcuserstate
/ExampleTypingAttributes.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad/WorkspaceSettings.xcsettings
/ExampleTypingAttributes.xcodeproj/xcuserdata/*.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
/ExampleTypingAttributes.xcodeproj/xcuserdata/*.xcuserdatad/xcschemes/ExampleTypingAttributes.xcscheme
/ExampleTypingAttributes.xcodeproj/xcuserdata/*.xcuserdatad/xcschemes/xcschememanagement.plist
~*
@febeling
febeling / gist:775864
Created January 12, 2011 08:15
Rake Quick Reference, by Greg Houston
# Rake Quick Reference
# by Greg Houston
# http://ghouston.blogspot.com/2008/07/rake-quick-reference.html
# -----------------------------------------------------------------------------
# Running Rake
# -----------------------------------------------------------------------------
# running rake from the command-line:
# rake --help
@febeling
febeling / Rakefile.rb
Created April 29, 2009 22:23
Create ruby stdlib documentation
require 'rbconfig'
LIBDIR = Config::CONFIG['rubylibdir']
DOCDIR = File.expand_path(Config::CONFIG['ruby_install_name'] + "_rdoc")
BINDIR = Config::CONFIG['bindir']
RUBY = BINDIR + '/'+ Config::CONFIG['ruby_install_name']
TITLE = "Ruby #{RUBY_VERSION} Stdlib Documentation"
/ruby(.*)/.match(Config::CONFIG['ruby_install_name'])
SUFFIX = $1
$ time dd if=/dev/urandom of=testfile bs=1024 count=$((1024 * 1024))
1048576+0 records in
1048576+0 records out
1073741824 bytes transferred in 158.475750 secs (6775433 bytes/sec)
real 2m38.479s
user 0m1.718s
sys 2m29.530s
$ time dd if=/dev/zero of=testfile bs=1024 count=1 seek=$((1024 * 1024))
1+0 records in
diff --git a/Rakefile b/Rakefile
index 5ee59ba..c213697 100644
--- a/Rakefile
+++ b/Rakefile
@@ -28,6 +28,7 @@ begin
s.homepage = "http://github.com/langalex/couch_potato"
s.description = "Ruby persistence layer for CouchDB"
s.authors = ["Alexander Lang"]
+ s.files = FileList["[A-Z]*.*", "{lib,spec,rails}/**/*", "init.rb"]
end