Skip to content

Instantly share code, notes, and snippets.

@vitorbritto
vitorbritto / rm_mysql.md
Last active May 13, 2024 01:28
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

    brew remove mysql
    
defmodule PostsRouter do
use Dynamo.Router
alias Ecto.SQL
import Ecto.Query
prepare do
conn.fetch :params
end
# GET /posts
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@sattybhens
sattybhens / excel_formulas.rb
Created December 28, 2011 05:35
discover unique excel formula's using JRuby and POI
# Given an Excel file... iterate over each cell that has a formula
# and collect all the unique formula signatures
# formula signature are in RPN and shown as
# => Ref#UnaryMinus#Ref#Multiply#Int#Int#Power#Divide#Ref#Multiply
# => Ref#Ref#Multiply#Ref#Ref#Multiply#Subtract#Parenthesis#Ref#Multiply#Int#Int#Power#Divide#Ref#Subtract
# => Ref#Ref#Multiply#Ref#Ref#Multiply#Subtract#Parenthesis#Ref#Multiply#Int#Int#Power#Divide#Ref#Multiply#Ref#Subtract
# => Ref#Ref#Multiply#Int#Int#Power#Divide
# => Ref#Area#Attr#Ref#Multiply#Ref#Multiply#Parenthesis#Divide
# => Ref#Area#Attr#Ref#Multiply#Int#Int#Power#Divide#Ref#Multiply#Parenthesis#Divide
# => Ref#Area#Attr#Ref#Multiply#Int#Int#Power#Divide#Parenthesis#Divide
require 'date'
class Date
# Try to read Marshal data of 1.9.3 Date
# !!CAUTION: COMPLETELY UNTESTED!!!
if RUBY_VERSION < "1.9.3"
def marshal_load(ary)
case ary.size
when 3
@ajd, @of, @sg, = ary
diff --git a/load.c b/load.c
index 9ed386d..1a6f5e9 100644
--- a/load.c
+++ b/load.c
@@ -270,7 +270,7 @@ rb_provide(const char *feature)
NORETURN(static void load_failed(VALUE));
static void
-rb_load_internal(VALUE fname, int wrap)
+rb_load_internal(VALUE fname, VALUE wrap)
@eregon
eregon / README.md
Created October 11, 2011 18:08
Theorical benchmark of `require` time when using Yura Sokolov's patch [Feature #5427]

This is a theoretical benchmark of require time comparing ruby 1.9.4 r33453 original and patched on a 64-bit Linux with a sequential hard disk.

It is theoretical because it is based on requiring a few hundreds empty files from the same folder, which is likely rare.

However, the global result (patched significantly faster than original) should be reflected in a certain measure in real life.

It is showing especially good results, because a file is never required twice, and so the unpatched version always has to check every file loaded.

The patched version could actually be slower when:

@markoa
markoa / deploy.rb
Created October 10, 2011 13:31
Ingredients to monitor Resque with God automatically via Capistrano (on Ubuntu)
namespace :deploy do
desc "Hot-reload God configuration for the Resque worker"
task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}"
sudo "god start resque"
end
end
# append to the bottom:
~/repo/ruby
$ mkdir rails/hacker-uplink && cd rails/hacker-uplink && touch Gemfile

~/repo/ruby/rails/hacker-uplink
$ ls
Gemfile

~/repo/ruby/rails/hacker-uplink
$ git init

Initialized empty Git repository in /Users/krainboltgreene/repo/ruby/rails/hacker-uplink/.git/