Skip to content

Instantly share code, notes, and snippets.

View jfreeze's full-sized avatar

Jim Freeze jfreeze

View GitHub Profile
$:.unshift Dir.chdir(File.join(Dir.chdir(File.dirname(__FILE__)) { Dir.pwd }, '/../lib')) { Dir.pwd }
** extensions.conf **
exten => 200,1,Answer
exten => 200,n,Wait(1)
exten => 200,n,ParkAndAnnounce(pbx-transfer:PARKED|5|Sip|inbound|4753|1)
** Logging **
Connected to Asterisk 1.4.24.1 currently running on talky (pid = 21585)
Verbosity is at least 3
class A < Sequel::Model
one_to_many :bs
one_to_one :active_b, :class => B
# Integer :b_id
end
class B < Sequel::Model
many_to_one :as
# Integer a_id for the one_to_many above
end
@jfreeze
jfreeze / rail3setup.textile
Created March 5, 2011 23:53
Rails 3 Setup for HAML, SASS, Compass and jQuery

Rails 3 Setup for HAML, SASS, Compass and jQuery

Create new project

rails new project_name
cd project_name

Add Gems to Gemfile

Add the following to Gemfile

@jfreeze
jfreeze / heroku run console
Created August 25, 2011 04:03
Problem with Sass on Heroku - Rails 3.1 rc6
-----> Compiled slug size is 24.9MB
-----> Launching... done, v7
http://hollow-autumn-208.herokuapp.com deployed to Heroku
To [email protected]:hollow-autumn-208.git
abce1c0..eb33c6a master -> master
<lsappsin30days/app6ruby-1.9.2-head@railsRC6 [app6 (master)]$ heroku run console
Running console attached to terminal... up, run.2
Sprockets::Environment#static_root is deprecated
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.1.0.rc6/lib/rails/railtie/configuration.rb:78:in `method_missing': undefined method `sass' for #<Rails::Application::Configuration:0x00000001bec278> (NoMethodError)
@jfreeze
jfreeze / rvmuse
Created September 8, 2011 23:22
RVM 'use' issue
[~]# rvm list
rvm rubies
ruby-1.9.2-p290 [ i386 ]
ruby-1.8.7-p352 [ i386 ]
[~]# rvm use 1.9.2
Using /usr/local/rvm/gems/ruby-1.9.2-p290
[~]# rvm gemset create runtime
@jfreeze
jfreeze / passphrase-generator.rb
Created February 2, 2012 15:46
Passphrase Generator
class Array
def qrand
self[rand(self.size)]
end
end
module Generate
def generate
@data.qrand
end
~ # esxcli software vib install -v scsi-3w-sas-3.26.00.003vm50-1OEM.500.0.0.472560.x86_64.vib
[VibDownloadError]
('scsi-3w-sas-3.26.00.003vm50-1OEM.500.0.0.472560.x86_64.vib', '', "[Errno 4] IOError: <urlopen error [Errno 2] No such file or directory: '/var/log/vmware/scsi-3w-sas-3.26.00.003vm50-1OEM.500.0.0.472560.x86_64.vib'>")
url = scsi-3w-sas-3.26.00.003vm50-1OEM.500.0.0.472560.x86_64.vib
Please refer to the log file for more details.
☺ ➔ xiki menu
pid-file for killed process 9278 found (/tmp/xiki_process.rb.pid), deleting.
/Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:129:in `gets': execution expired (Timeout::Error)
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:129:in `block (2 levels) in get_response'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:124:in `open'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:124:in `block in get_response'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:121:in `get_response'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/etc/command/xiki_command.rb:102:in `run'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/gems/xiki-0.6.3/bin/xiki:30:in `<top (required)>'
from /Users/jdf/.rvm/gems/ruby-1.9.2-p290/bin/xiki:19:in `load'
@jfreeze
jfreeze / app.js
Created May 15, 2013 12:56
Adjust ember-data url to add .json
http://stackoverflow.com/questions/14828478/ember-js-ember-data-restadapter-fail-to-load-json
// TravelClient.CUSTOMAdapter = DS.RESTAdapter.extend({
bulkCommit: false,
url: "http://remote_server_address",
buildURL: function(record, suffix) {
var s = this._super(record, suffix);
return s + ".json";
}
})