Skip to content

Instantly share code, notes, and snippets.

@vasanthela
vasanthela / working_around_having_to_merge_with_master_often.md
Last active December 29, 2015 21:46
Working around having to merge with master often

Working around having to merge with master often

Sometimes, when working with web frameworks like django/rails, one often has to run database migrations based on the latest master. But this can pose a problem when master could often have problems because multiple developers are changing code rapidly. Or can be a problem when updating to the latest master takes a lot of time, for example running migrations on django can take a while.

A way to avoid this is to work off a local version of master that that has been setup and migrated locally, and avoid continually following master.

1. Setup local version of master

# Assume sha ab1234 is the sha we want to track against in master for local development
@vasanthela
vasanthela / log_request_bodies.rb
Created June 2, 2014 07:03
Faraday Middleware to log request bodies.
# Custom Faraday Middleware to log request bodies
#
# Code borrowed from https://github.com/lostisland/faraday/pull/277
# Once the pull request gets merged, this middleware is unnecessary.
#
# Default option is to not print request bodies
#
# Example usage:
#
# # Defaults logger
@vasanthela
vasanthela / 1_Error
Last active August 29, 2015 13:55
Bundler::GemNotFound: Could not find minitest-4.7.5.gem for installation
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Using rake (10.1.1)
Using i18n (0.6.9)
Bundler::GemNotFound: Could not find minitest-4.7.5.gem for installation
An error occurred while installing minitest (4.7.5), and Bundler cannot continue.
Make sure that `gem install minitest -v '4.7.5'` succeeds before bundling.

Todo.rb

Todo.rb is a simple command-line tool for managing todos. It's minimal, straightforward, and you can use it with your favorite text editor.

Getting Started

Todo.rb doesn't require any third-party gems so you can copy the file anywhere and use it as long as it's executable:

@vasanthela
vasanthela / search.sh
Created November 3, 2013 20:45
Search and display list of local files by keywords
#!/usr/bin/env bash
# Setup colors
NONE='\033[00m'
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
# Example usage
if (($# == 0)); then
echo "Usage: ./search.sh keyword1 [keyword] ..."
@vasanthela
vasanthela / slow_terminal_load_mac_os_x.sh
Last active December 17, 2015 05:59
Terminal takes a long time to load on Mac OS X
# delete the *.asl log files and it will be snappier
sudo rm -f /private/var/log/asl/*.asl
@vasanthela
vasanthela / transfer_ssh_public_key_to_remote_server.sh
Last active December 17, 2015 04:39
Transfer ssh public key to remote server via ssh
# Works on Mac OS X
ssh remote.server.com "mkdir -p -m 700 .ssh; cat >> .ssh/authorized_keys; chmod 600 .ssh/authorized_keys;" < ~/.ssh/id_rsa.pub
@vasanthela
vasanthela / prob_spec.rb
Created October 15, 2011 18:34
Prerequisite AI Programming Assignment
# to run this file, in terminal window, do the following commands
# gem install rspec
# rspec prob_spec.rb
class Dice
#you can code the class here
#if you want to move the class code, move it to a file labelled as dice.rb
#place the statement: require "dice"
#at the top of this spec file