Skip to content

Instantly share code, notes, and snippets.

View krisleech's full-sized avatar

Kris Leech krisleech

View GitHub Profile
@krisleech
krisleech / gist:891120
Created March 28, 2011 19:42
JRuby ActiveRecord
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter=> "jdbcmysql",
:host => "localhost",
:database=> "chat",
:username => "root",
:password => ""
)
source 'http://rubygems.org'
gem 'rails', '3.0.3'
# gem "activerecord-jdbc-adapter", :require => "arjdbc"
gem "activerecord-jdbc-adapter", "0.9.7", :require => "jdbc_adapter"
# gem "jdbc-mysql"
# gem "jdbc-sqlite3"
gem "jruby-openssl"
<div id="left">
<%=render(:partial => "user_widget")%>
</div>
<div id="right">
<div class="box">
<div class="title"><h5>Users</h5></div>
<%
fields = [
{:label => 'Name', :method => :last_name, :display => lambda { |u| u.name } },
$ GIT_TRACE=1 git push test master
trace: built-in: git 'push' 'test' 'master'
trace: run_command: 'ssh' '[email protected]' 'git-receive-pack '\''/home/user/git/frogger'\'''
git: '/home/user/git/frogger' is not a git command. See 'git --help'.
fatal: The remote end hung up unexpectedly
-------------------------------------------------------------------------
$ ssh example.com 'type git-receive-pack ; type git'
@krisleech
krisleech / auditable.rb
Created June 2, 2011 13:17
Auditable, Problem with class var's
# Fixed
module Auditable
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def auditable(options = {})
# Untested, mind dump
class Document < ActiveRecord::Base
include Virtus
before_save :dump_attributes
after_initialize :load_attributes
private
$ env; alias
TERM=xterm
SHELL=/bin/bash
SSH_CLIENT=**** 59117 22
SSH_TTY=/dev/pts/0
USER=bluejam
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=0
@krisleech
krisleech / gist:1040330
Created June 22, 2011 15:21
RVM install on Ubuntu, permissions
$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
--------
$ curl -s https://rvm.beginrescueend.com/install/rvm
$ sh rvm
rvm: 3: shopt: not found
set: 6: Illegal option -o errtrace
@krisleech
krisleech / gist:1099226
Created July 22, 2011 10:42
torquebox:run
bundle exec rake torquebox:run *[next][jruby-1.6.2@green_tick]
zsh:1: no matches found: test/*
zsh:1: no matches found: test/*
WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method GreenTick::Application#task called at /Users/kris/.rvm/gems/jruby-1.6.2@green_tick/gems/railties-3.0.3/lib/rails/application.rb:214:in `initialize_tasks'
WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [args] => [deps]' instead.
at /Users/kris/.rvm/gems/jruby-1.6.2@green_tick/gems/sunspot_rails-1.2.1/lib/sunspot/rails/tasks.rb:41:in `(root)'
TorqueBox Server OK: /Users/kris/Sources/torquebox-current/jboss/server/default
=========================================================================
*** LOCAL GEMS ***
torquebox (1.1, 1.0.1)
torquebox-base (1.1 java, 1.0.1 java)
torquebox-messaging (1.1 java, 1.0.1 java)
torquebox-naming (1.1 java, 1.0.1 java)
torquebox-rake-support (1.1, 1.0.1)
torquebox-vfs (1.1 java, 1.0.1 java)
torquebox-web (1.1 java, 1.0.1 java)