Skip to content

Instantly share code, notes, and snippets.

View assembler's full-sized avatar

Milovan Zogovic assembler

  • metoda GmbH
  • Munich, Germany
  • 20:55 (UTC +02:00)
View GitHub Profile
@assembler
assembler / gist:2367018
Created April 12, 2012 12:51
Gemfile.lock
GIT
remote: git://github.com/assembler/rails-erd.git
revision: 53e01cf74f6f051bcdb283847d145ef84ce19dc4
specs:
rails-erd (0.5.0pre)
activerecord (~> 3.0)
activesupport (~> 3.0)
choice (~> 0.1.4)
ruby-graphviz (~> 1.0)
@assembler
assembler / simple_form.rb
Created March 30, 2012 09:24
defining default form options in simple_form
module SimpleForm::ActionViewExtensions::FormHelper
def simple_form_for_with_defaults(record, options={}, &block)
# define defaults here
simple_form_for_without_defaults(record, options, &block)
end
alias_method_chain :simple_form_for, :defaults
end
@assembler
assembler / gist:2047145
Created March 15, 2012 21:36
Render gists on tumblr
<!-- GIST Renderer -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"/>
<script type="text/javascript">
var cachedWrite = document.write,
body = $('body'),
gists = $("a[href*='gist.github.com'][href$='#embed']").get(),
embedNextGist = function() {
if (gists.length == 0) {
document.write = cachedWrite;
@assembler
assembler / gist:2000460
Created March 8, 2012 11:05
(homebrew) doctor: command line tools only
Warning: Your Xcode is configured with an invalid path.
You should change it to the correct path. Please note that there is no correct
path at this time if you have *only* installed the Command Line Tools for Xcode.
If your Xcode is pre-4.3 or you installed the whole of Xcode 4.3 then one of
these is (probably) what you want:
sudo xcode-select -switch /Developer
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
@assembler
assembler / gist:2000453
Created March 8, 2012 11:02
(homebrew) pango 1.28.4 fail to compile
==> Downloading http://ftp.gnome.org/pub/GNOME/sources/pango/1.28/pango-1.28.4.tar.bz2
File already downloaded in /Users/milovanzogovic/Library/Caches/Homebrew
/usr/bin/tar xf /Users/milovanzogovic/Library/Caches/Homebrew/pango-1.28.4.tar.bz2
==> Downloading patches
/usr/bin/curl -qf#LA Homebrew 0.8.1 (Ruby 1.8.7-249; Mac OS X 10.7.3) https://trac.macports.org/export/89719/trunk/dports/x11/pango/files/patch-G_CONST_RETURN.diff -o 001-homebrew.diff --silent
==> Patching
/usr/bin/patch -f -p0 -i 001-homebrew.diff
patching file modules/hebrew/hebrew-shaper.c
patching file pango/fonts.c
patching file pango/pango-attributes.c
@assembler
assembler / gist:1717300
Created February 1, 2012 14:26
Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.1)
actionpack (= 3.2.1)
mail (~> 2.4.0)
actionpack (3.2.1)
activemodel (= 3.2.1)
activesupport (= 3.2.1)
builder (~> 3.0.0)
@assembler
assembler / gist:1704047
Created January 30, 2012 11:58
Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.1)
actionpack (= 3.2.1)
mail (~> 2.4.0)
actionpack (3.2.1)
activemodel (= 3.2.1)
activesupport (= 3.2.1)
builder (~> 3.0.0)
@assembler
assembler / gist:1703964
Created January 30, 2012 11:36
Stack Trace
activerecord (3.2.1) lib/active_record/attribute_methods.rb:41:in `define_attribute_methods'
activerecord (3.2.1) lib/active_record/attribute_methods.rb:145:in `respond_to?'
activesupport (3.2.1) lib/active_support/callbacks.rb:398:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_find_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.2.1) lib/active_record/base.rb:520:in `init_with'
activerecord (3.2.1) lib/active_record/inheritance.rb:76:in `instantiate'
activerecord (3.2.1) lib/active_record/querying.rb:38:in `block (2 levels) in find_by_sql'
activerecord (3.2.1) lib/active_record/querying.rb:38:in `collect!'
activerecord (3.2.1) lib/active_record/querying.rb:38:in `block in find_by_sql'
@assembler
assembler / descriptive_sql_load_log.rb
Created December 7, 2011 10:26 — forked from jlindley/descriptive_sql_load_log.rb
Let Rails display file names and line numbers for log activity.
module ActiveRecord
module ConnectionAdapters
class AbstractAdapter
protected
# Rails 3.1
def log_with_trace(sql, name = "SQL", binds = [], &block)
if @logger && @logger.debug?
c = caller.detect{|line| line !~ /(activerecord|active_support|__DELEGATION__|\/lib\/|\/vendor\/plugins|\/vendor\/gems)/i}
c ||= caller.first
@assembler
assembler / bug.rb
Created October 12, 2011 15:19
validates_associated ignores :if option
# see: http://jonathanleighton.com/articles/2011/awesome-active-record-bug-reports/
require 'test/unit'
require 'ruby-debug'
require 'active_record'
puts "Active Record #{ActiveRecord::VERSION::STRING}"
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => ':memory:'