Skip to content

Instantly share code, notes, and snippets.

View calebhaye's full-sized avatar

Caleb Adam Haye calebhaye

View GitHub Profile
pksunkara / config
Last active July 6, 2024 16:01
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
name = Pavan Kumar Sunkara
email =
username = pksunkara
defaultBranch = master
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
sandys / table_to_csv.rb
Created October 18, 2012 10:04
convert a html table to CSV using ruby
# run using ```rvm jruby-1.6.7 do jruby "-J-Xmx2000m" "--1.9" tej.rb```
require 'rubygems'
require 'nokogiri'
require 'csv'
f ="/tmp/preview.html")
doc = Nokogiri::HTML(f)
csv ="/tmp/output.csv", 'w',{:col_sep => ",", :quote_char => '\'', :force_quotes => true})
benedikt / rails.rb
Created July 30, 2011 13:16
Capistrano task to open a rails console on a remote server. Require this file in your deploy.rb and run "cap rails:console"
# encoding: UTF-8
Capistrano::Configuration.instance(:must_exist).load do
namespace :rails do
desc "Open the rails console on one of the remote servers"
task :console, :roles => :app do
hostname = find_servers_for_task(current_task).first
exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && #{current_path}/script/rails c #{rails_env}'"
jimeh /
Created January 17, 2010 14:20
A simple key/value store model for Rails using the database and memcache

Rails Setting model

This is a semi-quick key/value store I put together for a quick way to store temporary data related to what's in my database, in a reliable way. For example, I'm using it to keep track of where a hourly and a daily crontask that processes statistics left off, so it can resume only processing and summarizing new data on the next run.

Code quality most likely is not great, but it works. And I will update this gist as I update my project.

How It Works

The settings table has two columns, a key and a value column. The value column is serialized, so you can technically store almost anything in there. Memcache is also used as a caching layer to minimize database calls.

# see -
# get latest from master
git pull origin master
# set "current feature" variable and create feature branch
export CURRENT_FEATURE=1234567-feature-name
git checkout -b $CURRENT_FEATURE
# or use the following to get the current branch name
rietta / example_deploy.rb
Created October 9, 2012 15:35
Capistrano Pre-compile Assets Locally and Deploy through Git
# One solution for deploying assets to production servers through git while
# precompiling the assets on the local development system.
# By Frank Rietta
# Copyright 2012 Rietta Inc. All Rights Reserved.
# Licensed as open source under terms of the BSD license.
# The script switches to the deploy branch, syncs it down, merges the changes from master, precompiles the
# assets and then pushes those to the deploy branch on remote so that the capistrano script can deploy the