Skip to content

Instantly share code, notes, and snippets.

View myabc's full-sized avatar

Alexander Brandon Coles myabc

  • London, England
  • 08:45 (UTC +01:00)
View GitHub Profile
@myabc
myabc / gist:6874053
Last active December 24, 2015 22:39 — forked from tonyc/gist:5989308
#/usr/bin/env bash
set -e
set -x
apt-get update
apt-get upgrade
apt-get -y install build-essential curl git-core openssl libreadline6 libreadline6-dev \
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \
@myabc
myabc / gist:3748905
Created September 19, 2012 10:31 — forked from gnunicorn/gist:3748738
Git for Beginners: Call for Coaches

The OpenTechSchool has set up and hosted a few tech workshops and meetups here in Berlin now. Aside from the monthly Beginners Meetup and hosting the Udacity Global Meetup we hosted workshops for program beginners in Python and Javascript on our own and on the premise of CampusParty.

One thing that was extraordinary popular on CampusParty was the Workshop on Git for beginners. And we decided to do it again, this time with a closer focus on version control as a major benefit in code sharing (by using git and github) for beginners - free of charge.

So if you are interested in

:javascript
function write_script() {
document.write('\x3Cscript type="text/javascript" src="foo.js">\x3C/script>');
}
write_script();
@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)
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
require 'rubygems'
require 'dm-core'
DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, 'mysql://root:@localhost/test')
DataMapper.setup(:logs, "sqlite3:///tmp/test.db")
class LoggedEvent
include DataMapper::Resource
require "rubygems"
require "dm-core"
require "dm-migrations"
DataMapper.setup(:default, "mysql://test:@localhost/test")
class Circle
include DataMapper::Resource
@myabc
myabc / gist:221466
Created October 29, 2009 14:08 — forked from dkubb/gist:152102
== Interfaces
=== Finder Interface
+ #[]
+ #all
+ #at
- #fetch <-- needs specs
+ #first
+ #first_or_create
# To use:
# mkdir _posts
# script/runner migrate_articles_from_mephisto_markdown_files.rb
articles = Article.find(:all)
articles.each do |article|
published_at = "#{article.published_at.year}-#{article.published_at.month}-#{article.published_at.day}" unless article.published_at.nil?
author = article.user.login
permalink = article.permalink
@myabc
myabc / gist:192941
Created September 24, 2009 18:36 — forked from dkubb/gist:31187
gem list '\A(?:(?:d[mo])[_-]|data_?(?:mapper|objects)|extlib)' --no-versions \
| xargs sudo gem uninstall -aIx