Skip to content

Instantly share code, notes, and snippets.

View chasballew's full-sized avatar

Chas Ballew chasballew

View GitHub Profile
@chasballew
chasballew / Aptible Gridiron GDPR Slack Community Code of Conduct.md
Last active May 25, 2018 22:22 — forked from henryhund/Aptible Gridiron GDPR Slack Community Code of Conduct.md
This is a code of conduct by which we govern the Aptible Gridiron GDPR Slack Community.

Join the Aptible Gridiron GDPR Slack Community here.

Read the Aptible Privacy Statement to learn:

  • What information we collect and why we collect it
  • How we use that information and when we disclose it
  • Your rights regarding that information, including how to access and update your information
  • The steps we take to protect your information

Aptible Gridiron GDPR Slack Code of Conduct

@chasballew
chasballew / cheryl.rb
Created April 26, 2015 01:18
Cheryl's Birthday in Ruby
# http://nbviewer.ipython.org/url/norvig.com/ipython/Cheryl.ipynb
DATES = ['May 15', 'May 16', 'May 19',
'June 17', 'June 18',
'July 14', 'July 16',
'August 14', 'August 15', 'August 17']
def month(date)
date.split[0]
end
@chasballew
chasballew / gist:d1e793611706d6542ada
Created December 13, 2014 02:46
Flask w/ requirements Dockerfile
# DOCKER-VERSION 0.4.0
from ubuntu:12.04
run echo 'deb http://us.archive.ubuntu.com/ubuntu/ precise universe' >> /etc/apt/sources.list
run apt-get -y update
run apt-get -y install python python-pip build-essential
run pip install flask flask-sqlalchemy
run apt-get -y purge build-essential
run apt-get -y autoremove
ADD . /opt/app
@chasballew
chasballew / gist:a6a8adb8f0ffe1a73f58
Last active August 29, 2015 14:11
Flask Dockerfile
# DOCKER-VERSION 0.4.0
from ubuntu:12.04
run echo 'deb http://us.archive.ubuntu.com/ubuntu/ precise universe' >> /etc/apt/sources.list
run apt-get -y update
run apt-get -y install python python-pip build-essential
run pip install flask flask-sqlalchemy
run apt-get -y purge build-essential
run apt-get -y autoremove
ADD . /opt/app
@chasballew
chasballew / gist:72110106225f45a85892
Last active August 29, 2015 14:10
Current dir name in bash terminal

Bash provides an environment variable called PROMPT_COMMAND. The contents of this variable are executed as a regular Bash command just before Bash displays a prompt[0]. You can use the output of regular commands in PROMPT_COMMAND. Here we use echo to construct the command to set the window title.

export PROMPT_COMMAND='echo -ne "\033]0;${PWD##*/}\007"'

The key sequence here is:
ESC]0;stringBEL -- Set icon name and window title to $string

Breaking it down:

unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE
system 'bundle'
end