This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
#PS1='\[\033[0;32m\]\W \u$ \[\033[0m\]' | |
source ~/.git-completion.bash | |
PS1='\[\e[0;33m\]\u\[\e[0;33m\]@\[\e[0;33m\]\h \[\e[0;32m\]\w\[\e[0;35m\]$(__git_ps1) \[\e[0;36m\]$(~/.rvm/bin/rvm-prompt) \n\[\e[0;31m\]\$\[\e[0;37m\] ' | |
#alias ci="git commit -m" | |
#alias cia="git commit --amend -m" | |
#alias fix="git commit -m \"bugfix\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bash | |
# | |
# bash completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Probably you will need to start with removing all your ruby stuff :) | |
rvm uninstall all | |
# Install just 32bit ruby | |
# NB! I failed with ruby-1.9.3, so... | |
rvm install 1.9.2 -n i386 --with-arch=i386 | |
# Then 32bit libyaml | |
CONFIGURE_OPTS="--with-arch=i386" CFLAGS="-arch i386" LDFLAGS="-arch i386" rvm pkg install libyaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Date | |
def beginning_of_halfyear | |
beginning_of_month.change(:month => [7, 1].detect { |m| m <= self.month }) | |
end | |
def end_of_halfyear | |
beginning_of_month.change(:month => [6, 12].detect { |m| m >= self.month }).end_of_month | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To close a misbehaving program properly. | |
# | |
# by desgua ([email protected]) | |
# | |
# License GPL | |
# | |
# version 0.03 02/22/2013 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomFormBuilder < ActionView::Helpers::FormBuilder | |
def text_field_with_error_placeholder field_name | |
text_field field_name, placeholder: (error_message_on field_name).scan(/\>(.*)\</).join(', ').html_safe | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# def post | |
# def put | |
[:post, :put].each do |type| | |
define_method type do |url, content| | |
uri = URI("http://google.com") | |
request = Module.const_get("Net::HTTP::#{type.capitalize}").new(uri) | |
request.body = content | |
Net::HTTP.start(uri.host, uri.port) { |http| http.request(request) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deploy your local working copy bypassing VCS | |
# | |
# Put this file into lib/capistrano/tasks/ and setup, e.g.: | |
# | |
# set :rsync_enabled, true | |
# set :rsync_options, %w[ | |
# --recursive --delete --delete-excluded | |
# --exclude .git* | |
# --exclude /test/*** | |
# --exclude /tmp/*** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ostruct' | |
class DeepStruct < OpenStruct | |
def initialize(hash=nil) | |
@table = {} | |
@hash_table = {} | |
if hash | |
hash.each do |k,v| | |
@table[k.to_sym] = (v.is_a?(Hash) ? self.class.new(v) : v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaults write com.google.Chrome AuthServerWhitelist '.domain1.com,.domain2.com' |
OlderNewer