This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn assoc-optionals | |
"Associate optional fields in a map if they are not nil" | |
([map key val] | |
(merge | |
map | |
(when-not (nil? val) {key val}))) | |
([map key val & kvs] | |
(let [ret (assoc-optionals map key val)] | |
(if kvs | |
(if (next kvs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Kill all running containers | |
docker kill $(docker ps -q) | |
# Remove all containers | |
docker rm $(docker ps -a -q) | |
# Remove all dangling images | |
docker rmi $(docker images -q --filter "dangling=true") | |
# Remove all images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pip list --outdated | awk '{print $1}' | xargs -n1 pip install -U |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit to http://martinfitzpatrick.name/article/add-git-branch-name-to-terminal-prompt-mac/ | |
# Get the current branch of the repo | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
# Trim the working directory | |
PROMPT_DIRTRIM=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Style/FileName: | |
Exclude: ['Vagrantfile', 'Gemfile', 'Berksfile', 'Dockerfile'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.mixin({ | |
sortedGroupBy : function(list, groupByIter, sortByIter) { | |
var groupBy = groupByIter; | |
if (_.isArray(groupByIter)) { | |
function groupBy(obj) { | |
return _.map(groupByIter, function(key, value) { | |
return obj[key]; | |
}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.mixin({ | |
exportCSV : function(array, exportColumns, includeHeaders) { | |
includeHeaders = typeof includeHeaders !== 'undefined' ? includeHeaders : true; | |
var csvData = []; | |
if(array.length > 0 && exportColumns.length > 0) { | |
if(includeHeaders) csvData = [_.chain(array[0]).pick(exportColumns).keys().value().join(', ')]; | |
_(array).each(function(element, index, list){ | |
csvData.push(_.chain(element).pick(exportColumns).values().value().join(', ')); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string ToQueryString(Dictionary<string, string> args) | |
{ | |
var array = args.Select(x => String.Format("{0}={1}", x.Key, x.Value)).ToArray(); | |
return "?" + string.Join("&", array); | |
} |