Skip to content

Instantly share code, notes, and snippets.

View benjaminoakes's full-sized avatar

Ben Oakes benjaminoakes

View GitHub Profile
class MyClass
def foo
@foo
end
def initialize(foo)
@foo = foo
end
def bar
@benjaminoakes
benjaminoakes / foo.csv
Created October 24, 2016 20:05
CSV test
foo bar baz
1 2 3
a b c
@benjaminoakes
benjaminoakes / install_docker_for_mac
Created October 20, 2016 17:08
Install Docker for Mac
#!/bin/sh
log_info() {
echo "[info] $*"
}
log_warn() {
echo "[warn] $*"
}
@benjaminoakes
benjaminoakes / Notes.md
Last active September 28, 2016 19:07
Meta Meetup 2016-09-28

Must do

  • Have another one of these meta meetups!

@chrisortman suggested an "open space" style meetup so people can break off and discuss topics.

  • Find out where meetup donations go.

I looked into this and Jerry is the only one with access to this part of the account. Still need to transfer total ownership over from him.

@benjaminoakes
benjaminoakes / allo.yml
Last active September 21, 2016 14:41
Google Template
---
product: Allo
service: Messaging
@benjaminoakes
benjaminoakes / enable_rake_tasks.diff
Created July 11, 2016 20:00
Why doesn't houndci.com check Rake tasks? (Rubocop does with this config...)
diff --git a/.ruby-style.yml b/.ruby-style.yml
index 28b4f49..8933d44 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -1,4 +1,11 @@
AllCops:
+ Include:
+ - '**/*.rb'
+ - '**/*.rake'
+ - '**/config.ru'
@benjaminoakes
benjaminoakes / git-run-ci
Last active March 31, 2017 16:43
Push to a run-ci (whitelisted) branch to run CI on Travis, etc.
#!/bin/sh
show_usage() {
cat <<EOF
Usage: $0 branch_name
Push to a run-ci (whitelisted) branch to run CI on Travis, etc.
NOTE: this is only necessary for a project like WebAdMIT that has disabled CI
for branches by default. We explicitly whitelisted \`run-ci/*\`.
@benjaminoakes
benjaminoakes / run-changed-tests.sh
Last active March 31, 2017 16:43
Rails: Run Changed Tests
#!/bin/sh
extant_files=""
for file in $(git diff --name-only master . | grep '^test' | grep -v '^test/factories' | grep -v '^test/support'); do
if [ -f "$file" ]; then
extant_files="$extant_files $file"
fi
done
set -x
@benjaminoakes
benjaminoakes / travisci_notifier.js
Last active April 27, 2017 18:52
Travis CI Notifier - run from console on a build page and you'll see a notification when it's done
// Straight from MDN
function notifyMe(s) {
// Let's check if the browser supports notifications
if (!("Notification" in window)) {
alert("This browser does not support desktop notification");
}
// Let's check whether notification permissions have already been granted
else if (Notification.permission === "granted") {
// If it's okay let's create a notification
@benjaminoakes
benjaminoakes / table_size.psql
Created April 21, 2016 20:38
Calculate size of PostgreSQL tables
dbname=# SELECT
dbname-#    relname as "Table",
dbname-#    pg_size_pretty(pg_total_relation_size(relid)) As "Size",
dbname-#    pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as "External Size"
dbname-#    FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;
                      Table                       |    Size    | External Size
--------------------------------------------------+------------+---------------
table1                           | 19 GB      | 1665 MB
table2                           | 12 GB      | 9720 MB
table3                           | 10 GB      | 5903 MB