Skip to content

Instantly share code, notes, and snippets.

View mfazekas's full-sized avatar

Miklós Fazekas mfazekas

View GitHub Profile
@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 / 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 / sanitize_test.rb
Created August 6, 2015 06:27
sanitize slow
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
# Activate the gem you are reporting the issue against.
@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 / dtrace_scripts.md
Last active April 6, 2016 19:56
DTrace scripts

rails hanged, why?

see what's ruby functions running

process id is 928

sudo dtrace -n \
  'ruby*:::method-entry {  printf("-> %s %s\n",copyinstr(arg0),copyinstr(arg1)) }' \
 -p 928
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
@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)