Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block gmhawash

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ofp.json
"title": "Portland HRC",
"body": "Something",
"location": [123.333, 98.2323]
gmhawash / gist:9234892
Created Feb 26, 2014
Docusign create document
View gist:9234892
require 'bundler'
DocusignRest.configure do |config|
config.username = ''
config.password = '********'
config.integrator_key = 'RFXX-5e8080a0-88d3-4c41-94b6-**********'
config.endpoint = ''
config.api_version = 'v2'
gmhawash / Rename Postrgres Database
Last active Oct 19, 2018
Rename a postgresql database with open connection
View Rename Postrgres Database
Postgres (rightfully) stops you from renaming a database while it has connections open connections. To test an exception handler which attempts to handle lost database connection, I was able to do the following:
1. \c (database that you are not trying to rename)
\c template1
2. select pg_terminate_backend(pid) from pg_stat_activity where datname ~ 'db_name_you_are_trying_to_rename';
3. alter database db_name_you_are_trying_to_rename rename to new_name;
View when-proc.rb
# ruby 1.9 supports 4 ways to call a proc! ex: f =->n {[:hello, n]}; f[:ruby];; f.(:ruby)
# turns out, you can also call a proc via proc === :arg -- which means you can use proc's in when clauses!
# ruby doc:
# ... kudos to @chadfowler for the tip!
# (note: works on 1.8.7 as well :-))
def am_i_awesome?
gmhawash / gist:8294627
Last active Jan 2, 2016
Create scrollable tables
View gist:8294627
How about doing something like this? I've made it from scratch...
What I've done is used 2 tables, one for header, which will be static always, and the other table renders cells, which I've wrapped using a div element with a fixed height, and to enable scroll, am using overflow-y: auto;
Also make sure you use table-layout: fixed; with fixed width td elements so that your table doesn't break when a string without white space is used, so inorder to break that string am using word-wrap: break-word;
gmhawash / gist:8293620
Last active Jan 2, 2016 — forked from ivanvanderbyl/gist:4222308
Upgrade Postgresql 9.1 to 9.3
View gist:8293620
# Add pg ppa to your respository list; go here:
# For ubuntu percise (12.04)
# Add the file: /etc/apt/sources.list.d/pgdg.list and in it add:
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3
View bootstrap_chef.bash
#!/usr/bin/env bash
# call like this on the target server:
# NODENAME='foo' CHEF_ENV='production' RUNLIST='["role[foo]","recipe[bar]"]' CHEFREPO='' bash <( curl -L )
# You will need to ensure that the ssh key is already set up on the server.
set -e
export CHEF_DIR="${HOME}/chef"
sudo rm -rf $CHEF_DIR
mkdir -p "$CHEF_DIR"
gmhawash / pather
Created Dec 10, 2013
pather code.
View pather
#!/usr/bin/env ruby
class Pather
def initialize(input)
@input = input.split("\n")
def output
x1 = nil
@input.each do |line|
View .watchr
#!/usr/bin/env ruby
if __FILE__ == $0
puts "Run with: watchr #{__FILE__}. \n\nRequired gems: watchr rev"
exit 1
class Specs
class << self
def run(cmd)
gmhawash / install_vim_files
Created Mar 5, 2013
Script to install vim plugins
View install_vim_files
echo "Installing ctags"
sudo apt-get install exuberant-ctags
if [ ! -e `which git` ]
You can’t perform that action at this time.