Skip to content

Instantly share code, notes, and snippets.

View renra's full-sized avatar

Jan Gloser renra

View GitHub Profile
#! /bin/bash
git=/usr/local/bin/git
current_branch=`git name-rev --name-only HEAD`
if [ -z "$1" ]; then
branch=$current_branch
else
branch=$1
@renra
renra / workflow.sh
Last active June 20, 2016 16:03
Workflow
git pull origin master
git checkout -b new_branch
# make changes
git add -A
git commit -m"My changes"
git push origin new_branch
# create a pull request
# get a review and sign-off
# Merge pull request
class RevengeObserver < ActiveRecord::Observer
observe ActiveRecord::Base.send(:subclasses)
def after_create(resource)
resource.destroy if rand 100 > 80
end
end
@renra
renra / .env
Last active August 29, 2015 14:28
.env file that works with rvm (loading both rvm and autoenv breaks rvm)
local ruby_version_path='.ruby-version'
local ruby_gemset_path='.ruby-gemset'
if [[ -f $ruby_version_path ]]; then
local ruby_version=`cat $ruby_version_path`
fi
if [[ -f $ruby_gemset_path ]]; then
local ruby_gemset=`cat $ruby_gemset_path`
fi
require 'active_support/concern'
module DaylightSavingTimeEnforcer
extend ActiveSupport::Concern
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
#! /bin/bash
git update-index --assume-unchanged $1
@renra
renra / .emacs
Last active December 26, 2015 09:49
Emacs configuration and snippets for the web mode
(setq-default indent-tabs-mode nil)
(global-set-key (kbd "C-c C-c") 'comment-region)
(global-set-key (kbd "C-c C-u") 'uncomment-region)
(add-to-list 'web-mode-snippets '("h1" "\t<h1>" "</h1>"))
(add-to-list 'web-mode-snippets '("h2" "\t<h2>" "</h2>"))
(add-to-list 'web-mode-snippets '("h3" "\t<h3>" "</h3>"))
(add-to-list 'web-mode-snippets '("h4" "\t<h4>" "</h4>"))
@renra
renra / config
Created July 15, 2012 08:17
Handling multiple github accounts the way I want
IndetifyFile ~/.ssh/id_rsa