Skip to content

Instantly share code, notes, and snippets.

# This tmux statusbar config was created by tmuxline.vim
# on Thu, 09 Jan 2014
set -g status-bg 'colour238'
set -g message-command-fg 'colour249'
set -g status-justify 'left'
set -g status-left-length '100'
set -g status 'on'
set -g pane-active-border-fg 'colour150'
set -g message-bg 'colour237'
.ruby-version
.php-version
*.swp
*.swo
*.un~
# Compiled source #
###################
*.class
*.dll
(evil-define-state god
"God state."
:tag " <G> "
:message "-- GOD MODE --"
:entry-hook (evil-god-start-hook)
:exit-hook (evil-god-stop-hook)
:input-method t
:intercept-esc nil)
(defun evil-god-start-hook ()
@shuber
shuber / svn.rake
Created September 26, 2008 20:54
Reads patterns from the .svnignore file in RAILS_ROOT and ignores them
namespace :svn do
desc 'Reads patterns from the .svnignore file in RAILS_ROOT and ignores them'
task :ignore => :environment do
# Set the svnignore filename and define the absolute path to that file
#
svnignore_path = File.join(RAILS_ROOT, '.svnignore')
# Ensure the svnignore file exists
#
@shuber
shuber / proc.php
Created March 24, 2009 21:50
phuby proc object pseudo-code
<?php
class Proc extends Object {
public $block;
public $parameters;
function initialize($block) {
$parameters = func_get_args();
$this->block = array_pop($parameters);
@shuber
shuber / custom_domain.rb
Created August 12, 2009 02:22 — forked from speedmax/customdomain.rb
DNS lookup for dynamic domains in rack applications
require File.dirname(__FILE__) + '/../../vendor/gems/net-dns-0.4/lib/net/dns/resolver'
# Custom Domain
# A Rack middleware to to resolve the custom domain to original subdomain
# for your multi telent application.
#
# It's all transperant to your application, it performs cname lookup and
# overwrite HTTP_HOST if needed
#
# www.example.org => example.myapp.com
@shuber
shuber / configure_mysql_5-3-0.sh
Created August 17, 2009 02:53
configuring mysql with php 5.3.0
./configure \
--prefix=/usr/local/php5.3 \
--mandir=/usr/local/share/man \
--infodir=/usr/local/share/info \
--with-config-file-path=/usr/local/etc \
--enable-calendar \
--with-iconv=/opt/local \
--enable-exif \
--enable-ftp \
--enable-wddx \
@shuber
shuber / restrict.rb
Created August 28, 2009 21:19 — forked from jondahl/has_many :dependent => :restrict
don't allow a record with has_many dependencies to be destroyed e.g. has_many dependent: :restrict
when :restrict do
method_name = "has_many_dependent_restrict_for_#{reflection.name}".to_sym
define_method(method_name) do
unless send(reflection.name).empty?
# change to named error...
raise ActiveRecord::StatementInvalid, "can't delete record because of dependent #{reflection.name}"
end
end
before_destroy method_name
end
@shuber
shuber / sync.rb
Created October 3, 2009 21:01 — forked from speedmax/sync.rake
sync files with a rake task
# app:sync
# Local and production synchronization
# - require yaml_db plugin
namespace :app
namespace :sync do
task :all => [:files, :db]
task :files do
`rsync -azv user@host:'/apps/myawesomeapp/shared/files/' #{Rails.root + 'files'}`
@shuber
shuber / connection_manager.php
Created January 15, 2010 19:42
a simple php database connection manager
<?php
abstract class ConnectionManager {
static $configurations = array();
static $connections = array();
static function &connection($name) {
if (!isset(self::$connections[$name])) self::establish_connection($name);
return self::$connections[$name];