Skip to content

Instantly share code, notes, and snippets.

View myabc's full-sized avatar

Alexander Brandon Coles myabc

  • London, England
  • 13:27 (UTC +01:00)
View GitHub Profile
:javascript
function write_script() {
document.write('\x3Cscript type="text/javascript" src="foo.js">\x3C/script>');
}
write_script();
function local_gemfile_on()
{
export BUNDLE_GEMFILE='Gemfile.local'; echo "Gemfile.local is being used…"
}
function local_gemfile_off()
{
unset BUNDLE_GEMFILE; echo "Gemfile is being used…"
}
@myabc
myabc / ice_nine.rb
Created March 18, 2012 12:08
Spike: Extensible Deep Freeze
# I didn't want to monkey patch #deep_freeze into core classes, plus I wanted
# to have a way to easily add new classes without modifying a case statement or
# similar. Plus I wanted a way for people to be able to specify exceptions for
# their own classes without patching mine.
module IceNine
def self.deep_freeze(object)
return object if object.frozen?
f = Freezer[object.class.name]
f.deep_freeze(object)
namespace :bundle do
def with_gemfile(gemfile)
old_gemfile = ENV['BUNDLE_GEMFILE']
ENV['BUNDLE_GEMFILE'] = gemfile
yield
ENV['BUNDLE_GEMFILE'] = old_gemfile
end
task :install do
`bundle install`

Welcome to Drift!

Drift is an always-already versioned, cloud-backed text editor. You can use it to take notes, and save them in the GitHub cloud.

Your gists are always saved locally, and any changes you make will get pushed to GitHub's servers.

To name a gist, touch its name in the toolbar.

You can use the share button at the top-right to copy a link to one of your gists, or view it on the web in Safari.

#!/bin/bash
# 1. Save this script somewhere
# 2. Change the following variable, adding the correct path and file extension
# for the files you want to handle.
files="directory/*.extension"
for f in $files; do
echo "Executing commands for file: $f ...";
# 3a. Add Command 1
#!/bin/bash
ruby -r base64 -r pp -e "pp Marshal.load(Base64.decode64('$1'))"
2011-05-08 20:11:56,684 INFO [Log4jLogger] : DataObjects::SQLError - DSRA9122E: class com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement enthält keine Objekte vom Typ interface oracle.jdbc.OraclePreparedStatement.:
C:/Program Files (x86)/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/WEB-WINDOWS7DEVNode01Cell/bds_war.ear/bds.war/WEB-INF/bundle/jruby/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:276:in `with_connection'
C:/Program Files (x86)/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/WEB-WINDOWS7DEVNode01Cell/bds_war.ear/bds.war/WEB-INF/bundle/jruby/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:113:in `create'
C:/Program Files (x86)/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/WEB-WINDOWS7DEVNode01Cell/bds_war.ear/bds.war/WEB-INF/bundle/jruby/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:85:in `each'
C:/Program Files (x86)/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/WEB-WINDOWS7DEVNode01Cell/bds_war.ear/bds.war/WEB-INF/bundle
gem 'friendly_id', '~> 3.1.0'
gem 'friendly_id_datamapper','~> 3.1.0',:git => 'http://github.com/myabc/friendly_id_datamapper.git'
config.after_initialize do
require 'app/support/naming_conventions'
::DataMapper.repository.adapter.resource_naming_convention = ::App::NamingConventions::Resource
end