Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jjhamshaw on github.
  • I am iamhamsure (https://keybase.io/iamhamsure) on keybase.
  • I have a public key ASAw55bnCcIep3rHK-xFtBPomnfV1MDzWukpjW0oyYnoQwo

To claim this, I am signing this object:

@jjhamshaw
jjhamshaw / docker postgres connection.sh
Created September 5, 2017 14:43
connect to your docker postgres container and run psql, without having to specify a container name or ID
docker exec -it $(docker ps -q --filter "name=postgres") psql -U postgres
@jjhamshaw
jjhamshaw / etl-runner.js
Created August 17, 2017 16:36
Conceptual idea
import async from 'async';
export default class ETLRunner {
constructor(extractor, transformer, loader) {
this.extractor = extractor;
this.transformer = transformer;
this.loader = loader;
}
extract(callback) {
@jjhamshaw
jjhamshaw / delete local git branches.sh
Last active September 13, 2017 13:44
scripts to clean up local git branches for a given repository
# safe delete branches
# (deletes all MERGED branches, except dev and master)
git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d
# delete branches
# (deletes all branches, except dev and master)
git branch | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -D
@jjhamshaw
jjhamshaw / open_xamarin.sh
Created February 1, 2016 16:13
open multiple instances of xamarin studio
open -n /Applications/Xamarin\ Studio.app
@jjhamshaw
jjhamshaw / AppCache.cs
Created April 22, 2015 02:11
A simple System.Runtime.Caching.MemoryCache wrapper
public class AppCache : ICache
{
public object GetValue(string key)
{
MemoryCache memoryCache = MemoryCache.Default;
return memoryCache.Get(key);
}
public bool Add(string key, object value, DateTimeOffset absExpiration)
{
[
{ "keys": ["ctrl+shift+l"], "command": "reveal_in_side_bar"},
// dependent on plugins
{ "keys": ["ctrl+k", "ctrl+f"], "command": "xml_prettify" }
]
@jjhamshaw
jjhamshaw / gist:8931729
Created February 11, 2014 09:25
remove deleted remote branches
# Option 1) remove deleted branches on fetch
git fetch --prune
# Option 2) create an alias. Open your config file...
git config -e
# ...and add the following section
[alias]
@jjhamshaw
jjhamshaw / gist:3305817
Created August 9, 2012 16:49
powershell db copy
task BackupTestToQaDatabase {
try {
Invoke-Sqlcmd -InputFile $copySqlDatabase -ServerInstance $sqlserver -Database $databaseToBackUp -Username $databaseUsername -Password $databasePassword -QueryTimeout 240 -ErrorAction 'Stop'
} catch {
'##teamcity[buildStatus status='FAILURE' text='Build Failed']'
}
}
@jjhamshaw
jjhamshaw / TryCatchFinally.cs
Created June 10, 2012 14:46
try, catch, finally
try
{
// code which can cause an exception
}
catch (exception_type e)
{
// code for handling the exception
}
finally
{