Skip to content

Instantly share code, notes, and snippets.

View knoopx's full-sized avatar

Víctor Martínez knoopx

View GitHub Profile
@knoopx
knoopx / Clear OSX DNS cache
Created February 8, 2010 17:11
Clear OSX DNS cache
dscacheutil -flushcache
@knoopx
knoopx / exception_helper.rb
Created November 9, 2011 14:30 — forked from agibralter/exception_helper.rb
Accessing app errors when using Capybara/Selenium with RSpec
# -*- encoding : utf-8 -*-
# Because Capybara.app gets run by Thin in a separate thread, errors raised in
# the application during request_specs get hidden and just show up in the
# selenium-controller browser as 500 errors with no extra info. This module
# helps us dig into those errors.
module RequestSpecs
module ExceptionHelper
@@last_exception = nil
@knoopx
knoopx / post-commit.rb
Created June 14, 2012 22:04
Gitshots Post-Commit Hook
#!/usr/bin/env ruby
# Requires imagesnap from https://github.com/alexwilliamsca/imagesnap (brew install imagesnap)
# To assemble the video use http://www.dayofthenewdan.com/projects/tlassemble
file="~/.gitshots/#{Time.now.to_i}.jpg"
puts "Taking capture into #{file}!"
system "imagesnap -q -w 3 #{file}"
exit 0
@knoopx
knoopx / boostrap.markdown
Created June 21, 2012 12:07
Setting Up A New Server

Setting up a Rails application on a new server

This guide assumes the following points:

  • You are using a debian-based operating system
  • You would like to deploy your application using RVM, Capistrano and Bundler
  • Your application source code is hosted on a remote GIT repository

Update the operating system

@knoopx
knoopx / homebrew formulas
Last active December 15, 2015 06:09
My homebrew formula stack
ack
binutils
colordiff
coreutils
curl
curl-ca-bundle
ffmpeg
ffmpegthumbnailer
findutils
git
@knoopx
knoopx / knoopx.zsh-theme
Created March 25, 2013 18:23
My oh-my-zsh theme
PROMPT='%{$fg[grey]%}%n@%m %{$fg[green]%}%~%{$reset_color%}$(__git_ps1) %{$fg[green]%}$%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=") "
* Get rid of default gems: turbolinks, uglifier
* Replace require 'rails/all' with specific railties
* Add lib to autoload path: `config.autoload_paths += %W(#{config.root}/lib)`
* Replace default railties
* Add some other gems
@knoopx
knoopx / sshd_config
Last active December 15, 2015 17:09
# This prevents capistrano from hanging when executing long tasks
# /etc/ssh/sshd_config
TCPKeepAlive yes
ClientAliveInterval 15
ClientAliveCountMax 5
# Restart sshd
@knoopx
knoopx / README.md
Last active December 19, 2015 22:58
Send github pull requests from the command line
@knoopx
knoopx / I18n.exception_handler = SimpleExceptionHandler
Created November 13, 2013 12:23
I18n.exception_handler = SimpleExceptionHandler
class SimpleExceptionHandler < I18n::ExceptionHandler
def self.call(exception, locale, key, options)
if exception.is_a?(I18n::MissingTranslation)
exception.keys.last.to_s.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1.capitalize }
else
super
end
end
end