Skip to content

Instantly share code, notes, and snippets.

View kusor's full-sized avatar
💭
Positively happy

Pedro Palazón Candel kusor

💭
Positively happy
  • Joyent Inc.
  • Murcia (Spain)
  • X @kusor
View GitHub Profile
require 'sinatra/base'
module Sinatra
# Use from classic "top-level" applications with:
# require 'sinatra'
# require 'sinatra/extension_template'
#
# Use from modular applications with:
# require 'sinatra/base'
# require 'sinatra/extension_template'
@kusor
kusor / vimrc
Created March 3, 2009 19:33 — forked from vmunix/vimrc
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set background=dark
set title " set xterm title
set history=1000 " keep 1000 lines of command line history
#!/usr/bin/env ruby
require 'rubygems'
gem 'dm-core', '>=0.9.10'
require 'dm-core'
DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, 'sqlite3::memory:')
module Foo
require 'rubygems'
require 'extlib'
module Extlib
module Inflection
class << self
# Take a complete module/class name and returns the scope where that module/class has been defined:
#
# @example
# module_scope("ActiveRecord::CoreExtensions::String::Inflections") #=> "ActiveRecord::CoreExtensions::String"
require "yaml"
require "irb"
require Pathname("irb/completion")
# TODO: error handling for:
# missing adapter, host or database
module DataMapper
class CLI
# Run before specs with:
# ruby spec_service.rb -p 4000
# Sinatra application to provide dm-rest-adapter an end-point:
require 'rubygems'
require 'sinatra'
require 'dm-core'
require 'dm-serializer'
# Note that we cannot wrap this stuff into a 'before' block
require 'net/http'
module Net
class BufferedIO
def rbuf_fill
timeout(@read_timeout, ProtocolError) {
@rbuf << @io.sysread(1024)
}
end
end
end
require 'irb/completion'
require 'irb/ext/save-history'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
@kusor
kusor / setting up PHP mcrypt.sh
Created June 23, 2009 11:44
libmcrypt + php (Snow) Leopard
cd src/
wget http://puzzle.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar xzvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --disable-dependency-tracking
make -j6
sudo make install
$ php --version
PHP 5.3.0 (cli) (built: Jul 19 2009 00:34:29)
Here's an example of how I was able to use the rsp from Smart.app to run on a different
port at the same time. It would be nice if this ability was built into the GUI app, but
for now, I hacked it.
I made a directory for my app here:
/Users/jim/joyent/rsp/local-smartasks
I put the application source in a subdirectory called '127.0.0.1'. So the bootstrap.js is
at /Users/jim/joyent/rsp/local-smartasks/127.0.0.1/js/bootstrap.js