Skip to content

Instantly share code, notes, and snippets.

View mfazekas's full-sized avatar

Miklós Fazekas mfazekas

View GitHub Profile
@interface LoggerProxy : NSObject
{
id original;
}
- (id)initWithOriginal:(id) value;
@end
@implementation LoggerProxy
@mfazekas
mfazekas / gdbassemble.gdb
Created February 15, 2011 13:01
gdb assemble macro
define assemble
# dont enter routine again if user hits enter
dont-repeat
if ($argc)
if (*$arg0 = *$arg0)
# check if we have a valid address by dereferencing it,
# if we havnt, this will cause the routine to exit.
end
printf "Instructions will be written to %#x.\n", $arg0
else
@mfazekas
mfazekas / parametric.py
Last active June 10, 2016 10:57
Parametric tests for nose/python unittest
#!/usr/bin/python
""" Implement parametric testMethods and testCases for nose and unittest
usage for parametric test methods:
@parametric
class MyTest(unittest.TestCase):
@parametric(foo=[1,2],bar=[3,4])
def testWithParams(self,foo,bar):
self.assertLess(foo,bar)
@mfazekas
mfazekas / gist:c13d76b027ca3ee6923e
Created June 27, 2014 05:38
accepts_nested_attributes_for has_many and new association with ids.
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@mfazekas
mfazekas / SassMeister-input-HTML.html
Created July 31, 2014 10:52
Generated by SassMeister.com.
<div class="container">
<h1>This page contains some example of <b>@extend</b> where ther result is non obvious</h1>
<h2>Example 1</h2>
<span>First button bellow is done via simple col-xs-1 attribute, second done via @extend</span>
<div class="small-box">
<div class="row">
<button class="btn col-xs-1">+</button>
</div>
<div class="row">
<button class="btn col-xs-1-via-extend">+</button>
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
gem 'byebug'
GEMFILE
system 'bundle'
@mfazekas
mfazekas / gist:cc7792802859d91e3fcb
Last active June 24, 2016 09:53
Monkey patch for fixing infinite loop in autosave_association
# fixes 'https://github.com/rails/rails/pull/16640'
# add this to lib/patches/active_record/autosave_association.rb
# then in config/environment.rb before initialize! load this file with
# something like:
# require File.join(File.dirname(__FILE__), '../lib/patches/active_record/autosave_association.rb')
# see https://gist.github.com/mfazekas/cc7792802859d91e3fcb
require 'active_record/autosave_association'
module ActiveRecord
@mfazekas
mfazekas / rr42_action_mailer_deliver.rb
Last active August 29, 2015 14:10
deliver_now in action mailer objects bugreport https://github.com/rails/rails/issues/17965
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
#gem 'rails', github: 'rails/rails', branch: '4-2-stable'
gem 'rails', '4.2.0.rc2'
#gem 'rails', '4.1.8'
#gem 'arel', github: 'rails/arel'
#gem 'rack', github: 'rack/rack'
gem 'i18n', github: 'svenfuchs/i18n'
@mfazekas
mfazekas / gist:a2b030278931a209cc23
Created December 9, 2014 14:30
rr42_active_record pluck and bind values
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
gem 'pg'
gem 'byebug'
GEMFILE
@mfazekas
mfazekas / rr42_create_obj_with_serialized_perf.rb
Created December 14, 2014 23:27
rr42_create_obj_with_serialized_perf
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.1.8'
#gem 'rails', '4.2.0.rc3'
gem 'sqlite3'
gem 'pg'
gem 'byebug'
GEMFILE