Skip to content

Instantly share code, notes, and snippets.

View mfazekas's full-sized avatar

Miklós Fazekas mfazekas

View GitHub Profile
# frozen_string_literal: true
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
@mfazekas
mfazekas / test-children.rb
Created February 20, 2017 08:47
awesome-nested-set-children
# test-children.rb
# This is a stand-alone test case.
# Run it in your console with: `rubytest-children.rb`
# If you change the gem dependencies, run it with:
# `rm gemfile* && ruby test-children.rb`
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
# Rails master
@mfazekas
mfazekas / test-ransack-join.rb
Last active February 17, 2017 11:13
test ransack join issue
# test-ransack-join.rb
# This is a stand-alone test case.
# Run it in your console with: `ruby test-ransack-scope-and-column-same-name.rb`
# If you change the gem dependencies, run it with:
# `rm gemfile* && ruby test-ransack-scope-and-column-same-name.rb`
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
# Rails master
@mfazekas
mfazekas / test-ransack-double-self-join.rb
Created February 17, 2017 09:15
ransack double self join issue
# test-ransack-double-self-join.rb
# This is a stand-alone test case.
# Run it in your console with: `ruby test-ransack-scope-and-column-same-name.rb`
# If you change the gem dependencies, run it with:
# `rm gemfile* && ruby test-ransack-scope-and-column-same-name.rb`
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
# Rails master
@mfazekas
mfazekas / gist:ac0556c54438af510df8b4cc1e91188d
Last active January 26, 2017 06:47
proxy server for proxying percy.io to dev.percy.local and percy.io
require 'webrick'
require 'webrick/https'
require 'webrick/httpproxy'
require 'byebug'
require 'net/http'
# make sure /etc/host has percy.io as localhost
API_HOST = 'percy.io'
@mfazekas
mfazekas / start-mirage.js
Created December 28, 2016 21:31
start a global express server for mirage in fastboot instance-initializers/fastboot/start-mirage.js
/* instance-initializers/fastboot/start-mirage.js */
/*global process*/
import { startMirage } from 'percy-web/initializers/ember-cli-mirage';
import config from '../../config/environment';
function startFastBootMirage() {
if (config['ember-cli-mirage'] && config['ember-cli-mirage'].fastbootGlobal) {
let port = config['ember-cli-mirage'].fastbootGlobal.port;
return startMirage({
environment: 'development',
@mfazekas
mfazekas / test_transaction_deadlock_mc.rb
Last active August 8, 2017 12:17
test_transaction_deadlock_mc.rb
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'
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 / 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.
@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