Skip to content

Instantly share code, notes, and snippets.

View elgalu's full-sized avatar

Leo Gallucci elgalu

View GitHub Profile
@lsaffie
lsaffie / pre-commit
Created August 5, 2012 20:00
pre-commit git hook that checks for values in the FORBIDDEN array
#!/bin/bash
# Pre commit hook that prevents FORBIDDEN code from being commited.
# Add unwanted code to the FORBIDDEN array as necessary
FILES_PATTERN='\.(rb|js|coffee)(\..+)?$'
FORBIDDEN=( debugger ruby-debug )
for i in "${FORBIDDEN[@]}"
do
@nilium
nilium / key-bindings.json
Created August 11, 2012 23:14
A Sublime Text 2 plugin to enable running multiple commands in any given context from a single key binding.
[
{
"keys": ["ctrl+w"],
"command": "run_multiple",
"args": {
"commands": [
{"command": "find_under_expand", "args": null, "context": "window"},
{"command": "show_panel", "args": {"panel": "find"}, "context": "window"}
]
}
@wacko
wacko / gist:4221847
Created December 6, 2012 04:48
Search Engine (shorcuts)
Gmail
https://mail.google.com/mail/u/0/#inbox
Calendar
https://www.google.com/calendar/render?tab=mc
Delicious
http://www.delicious.com/joaquinvicente/%s
Google Maps (Ciudad de BsAs)
@MicahChalmer
MicahChalmer / .htaccess
Last active May 1, 2016 16:49
Scripts to set up Ruby 1.9.3 on a DreamHost shared hosting account via rbenv and ruby-build, and run a Rack app with it via FastCGI.
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
</IfModule>
Options +FollowSymLinks +ExecCGI
RewriteEngine On
@krmahadevan
krmahadevan / MyRemoteProxy.java
Created January 27, 2013 18:27
This is a custom Proxy. This proxy when injected into the Grid, starts counting unique test sessions. After "n" test sessions, the proxy unhooks the node gracefully from the grid and self terminates gracefully. The number of unique sessions is controlled via a properties file : "mygrid.properties".
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.openqa.grid.common.RegistrationRequest;
import org.openqa.grid.internal.Registry;
@krmahadevan
krmahadevan / NodeShutDownServlet.java
Created January 27, 2013 18:43
A simple servlet which basically issues a System.exit() when invoked. This servlet would have to be injected into the node [not the Grid] so that it can help in terminating the node.
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* A simple servlet which basically issues a System.exit() when invoked.
* This servlet would have to be injected into the node [not the Grid] so that it can help in terminating the node.
@theotherzach
theotherzach / 20130310141955_add_hstore_extension.rb
Last active June 7, 2026 11:46
Rails 4 and Postgres: Getting HStore and Array
class AddHstoreExtension < ActiveRecord::Migration
def up
execute 'CREATE EXTENSION hstore'
end
def down
execute 'DROP EXTENSION hstore'
end
end
@jswanner
jswanner / migrate.rake
Last active August 15, 2024 15:15
Rolls back migrations in current branch not present in specified branch.
desc 'rolls back migrations in current branch not present in other'
task :rollback_branch_migrations, [:other_branch] do |t, args|
load "#{Dir.pwd}/Rakefile"
branch_migrations = BranchMigrations.new(args.other_branch)
puts ['Rollback the following migrations', branch_migrations, 'y,n? ']
next if %w[no n NO N].include?(STDIN.gets.chomp)
Rake::Task['environment'].invoke
@christianchristensen
christianchristensen / jenkins.yml.md
Last active February 2, 2017 18:05
.jenkins.yml research and thoughts

.jenkins.yml

Build configuration(s) closer to code; inspired by .travis.yml

  • Default yaml file to define a build that runs make test
  • Preserves No State Between Builds (runs all commands over SSH in isolated virtual machines)
  • The standard Unix exit code of "0" means the build passed; everything else is treated as failure.
  • Specify branches to build (whitelist, blacklist)
  • Secure environment variables (keys, configuration, ...)
@txus
txus / .pryrc.rb
Last active December 18, 2015 17:59
Pry command to trace a method invocation and log backtraces of each invocation to a file.
def write_backtrace name, backtrace, filename
exceptions = Regexp.union([
/\.bundle/,
/spec/,
/test/,
/lib\/ruby\/1.9.1/
])
backtrace.reject! { |line| line =~ exceptions }