Skip to content

Instantly share code, notes, and snippets.

Constantine Nikolaou cnicolaou

Block or report user

Report or block cnicolaou

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .bashrc
# $ tweet Hi mom!
#
# Put this in ~/.bashrc or wherever.
# If it doesn't work, make sure your ~/.netrc is right
#
# (Thanks to @anildigital and @grundprinzip for curl-fu)
function tweet {
curl -n -d status="$*" https://twitter.com/statuses/update.xml --insecure &> /dev/null
echo "tweet'd"
View README
You must be using git and capistrano to deploy your app. Capistrano will place a file in your Rails.root named 'REVISION'. Tested with the following capistrano setting:
set :scm, :git
set :deploy_via, :remote_cache
View README.rdoc

Rails 2.3.5 on App Engine

We assumed Rails 2 would never work without rubygems, and we committed to gem bunlder for JRuby on App Engine, so we were waiting for Rails 3. Fortunately, Takeru Sasaki was able to patch the Rails 2.3.5 calls to rubygems, and now we have it working. Rails 2.3.5 currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.

Install the Development Environment

The gems for the development environment include a pre-release appengine-tools gem that provides a pre-release version of jruby-rack.

sudo gem install google-appengine
sudo gem install appengine-tools --pre
View environment.rb
config.gem "thoughtbot-factory_girl", :lib => "factory_girl", :source => "http://gems.github.com", :version => "1.2.2"
config.gem "test-unit", :version => "2.0.3", :lib => 'test/unit'
config.gem "thoughtbot-shoulda", :lib => "shoulda", :source => "http://gems.github.com", :version => "2.10.2"
config.gem "ruby-openid", :lib => "openid"
config.gem "authlogic", :version => "2.1.2"
config.gem "authlogic-oid", :lib => "authlogic_openid"
config.gem "searchlogic", :version => "2.3.5"
config.gem "thoughtbot-paperclip", :lib => "paperclip", :version => "2.3.1", :source => "http://gems.github.com"
View access.php
<?php
class AccessComponent extends Object {
public $settings = array();
public $defaults = array(
'admin_required' => array(),
'auth_denied' => array(),
'auth_required' => array(),
'denied' => array(),
'callback' => 'initialize');
View gsl install failure
(09:34) cn5:~/Downloads/gsl-1.9$ gem install gsl
Building native extensions. This could take a while...
ERROR: Error installing gsl:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking gsl version... 1.9
checking gsl cflags... -I/usr/local/include
checking for main() in -lcblas... yes
checking for main() in -latlas... yes
View rails binary gems
config.gem 'factory_girl',
:version => '>= 1.2.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/factory_girl'))
# Cucumber and dependencies
config.gem 'polyglot', :lib => false,
:version => '0.2.9' unless File.directory?(File.join(Rails.root, 'vendor/plugins/polyglot'))
config.gem 'treetop', :lib => false,
:version => '1.4.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/treetop'))
config.gem 'term-ansicolor', :lib => false,
View trivial_file_upload_service.rb
require 'rubygems'
require 'sinatra'
require 'fileutils'
# upload with:
# curl -v -F "data=@/path/to/filename" http://localhost:4567/user/filename
post '/:name/:filename' do
userdir = File.join("files", params[:name])
View Unicorn capistrano deploy.rb
# capistrano deployment
require "bundler/capistrano"
require "capistrano/ext/multistage"
set :stages, %w(canary production)
set :default_stage, "canary"
set :application, "lolcats"
set :deploy_to, "/srv/#{application}"
@cnicolaou
cnicolaou / rvm + rubinius
Created Jun 14, 2011
installing rubinius using rvm
View rvm + rubinius
(12:17) user:~$ rvm install rbx-2.0.0pre
rbx-2.0.0pre installing #dependencies
Pulling from origin 2.0.0pre
ERROR: Error running 'git reset --hard HEAD ; git pull --rebase origin 2.0.0pre', please read /Users/user/.rvm/log/rbx-2.0.0pre/rbx.repo.log
fatal: Not a git repository (or any of the parent directories): .git
Copying from repo to source...
chmod: ./configure: No such file or directory
rbx-2.0.0pre - #configuring
ERROR: Error running '/Users/user/.rvm/wrappers/ree-1.8.7-2011.03/ruby ./configure --prefix=/Users/user/.rvm/rubies/rbx-2.0.0pre --skip-system ', please read /Users/user/.rvm/log/rbx-2.0.0pre/configure.log
ERROR: There has been an error while running '/Users/user/.rvm/wrappers/ree-1.8.7-2011.03/ruby ./configure --prefix=/Users/user/.rvm/rubies/rbx-2.0.0pre --skip-system '.
You can’t perform that action at this time.