Skip to content

Instantly share code, notes, and snippets.

Giles gilesbowkett

Block or report user

Report or block gilesbowkett

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
@gilesbowkett
gilesbowkett / clean-branches.bash
Created Apr 16, 2019
easily clean git branches
View clean-branches.bash
ruby bin/clean-branches.rb $* >/dev/null 2>/dev/null && git for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' refs/heads
View tab-title.bash
function this() { # obtain git branch
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
# https://superuser.com/a/599156
function tab-title {
echo -ne "\033]0;"$*"\007"
}
View giles_prompt.bash
function giles_prompt {
tab-title $(this)
# display git user name for pairing via git pair
# "this" function returns git branch name
export PS1="\[\033[0;95m\]<\u (\$(git config user.name))> \[\033[0;96m\]\w\[\033[0m\]\[\033[0;32m\] \$(this)\[\033[0m\]\n\[\033[0;34m\] $(unicode_nonsense)\[\033[0m\] "
}
export PROMPT_COMMAND=giles_prompt
View unicode_nonsense.bash
function unicode_nonsense {
if [ $? -eq 0 ]
then echo "\[\033[0;32m\]ᕕ(ᐛ)ᕗ"
else echo "\[\033[0;31m\]¯\_(ツ)_/¯"
fi
}
@gilesbowkett
gilesbowkett / にほんご.rb
Last active Oct 14, 2016
flash cards vocabulary
View にほんご.rb
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
# FIXME: only a few flash cards have forms or parts of speech, enough to get the idea going.
View d-gen.clj
(asdf)
(defn- state-line [[state results]]
(let [d (->> results
(sort-by :year)
(reduce (fn [line {:keys [year from-center]}]
(conj line (str (x-for-margin from-center)
","
(+ 10 (year-base year)))))
@gilesbowkett
gilesbowkett / wat.txt
Created Sep 8, 2016
remove the duplication
View wat.txt
¯\_(ツ)_/¯ ag "remove the duplication"
node_modules/angular2/bundles/angular2-all.umd.js
160: // TODO(alexeagle): remove the duplication of this doc. It is copied from ComponentMetadata.
185: // TODO(alexeagle): remove the duplication of this doc. It is copied from DirectiveMetadata.
565: // TODO(alexeagle): remove the duplication of this doc. It is copied from ViewMetadata.
614: // TODO(alexeagle): remove the duplication of this doc. It is copied from QueryMetadata.
723: // TODO(alexeagle): remove the duplication of this doc. It is copied from ContentChildrenMetadata.
745: // TODO(alexeagle): remove the duplication of this doc. It is copied from ContentChildMetadata.
767: // TODO(alexeagle): remove the duplication of this doc. It is copied from ViewChildrenMetadata.
848: // TODO(alexeagle): remove the duplication of this doc. It is copied from ViewChildMetadata.
@gilesbowkett
gilesbowkett / governance.md
Last active Mar 11, 2016
GitHub and "canonical" vs "original"
View governance.md
View table.md
Topic Remark
Potatoes Hot
Butter Inedible
Chile Green
View strong_params.rb
class PeopleController < ActionController::Base
# This will raise an ActiveModel::ForbiddenAttributes exception because it's using mass assignment
# without an explicit permit step.
def create
Person.create(params[:person])
end
# This will pass with flying colors as long as there's a person key in the parameters, otherwise
# it'll raise a ActionController::MissingParameter exception, which will get caught by
# ActionController::Base and turned into that 400 Bad Request reply.
You can’t perform that action at this time.