This file contains hidden or 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
def check_grade(grade) | |
puts "Checking #{grade}" | |
case grade | |
when 90..100 | |
puts "A" | |
when 80...90 | |
puts "B" | |
else | |
puts "loser" | |
end |
This file contains hidden or 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
<!-- | |
This disables app transport security and allows non-HTTPS requests. | |
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better | |
approach is to fix the non-secure resources. However, this patch will work in a pinch. | |
To apply the fix in your Ionic/Cordova app, edit the file located here: | |
platforms/ios/MyApp/MyApp-Info.plist | |
And add this XML right before the end of the file inside of the last </dict> entry: |
This file contains hidden or 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 | |
# directory to save backups in, must be rwx by postgres user | |
BASE_DIR="/var/backups/postgres" | |
YMD=$(date "+%Y-%m-%d") | |
DIR="$BASE_DIR/$YMD" | |
mkdir -p $DIR | |
cd $DIR | |
# make database backup |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'json' | |
if ARGV.length < 3 then | |
puts "Usage: squirt <filename> <channel> <comment>" | |
exit | |
end | |
token = ENV['TOKEN'] || "" |
This file contains hidden or 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
#!/usr/bin/env ruby | |
# Copyright 2015 Colin Bartlett, Inc. | |
# MIT Licensed: http://opensource.org/licenses/MIT | |
# Usage: ./average_deploy.rb your-heroku-app-name | |
require 'time' | |
dates = `heroku releases -n 50 -a #{ARGV[0]} | grep Deploy` |
This file contains hidden or 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
Error detected while processing User Auto commands for "ProjectionistDetect": | |
E716: Key not present in Dictionary: rake_command('static'))}}) | endif | |
E116: Invalid arguments for function split(rails#app().rake_command('static'))}}) | endif | |
E116: Invalid arguments for function projectionist#append | |
UpdateLastColumn failed to find bufnr 9 in w:BufKillList | |
UpdateLastColumn failed to find bufnr 9 in w:BufKillList |
This file contains hidden or 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
model_base = Rails.root.join('app/models') | |
Dir[model_base.join('**/*.rb').to_s].each do |filename| | |
# get namespaces based on dir name | |
namespaces = (File.dirname(filename)[model_base.to_s.size+1..-1] || '').split('/').map{|d| d.camelize}.join('::') | |
# skip concerns folder | |
next if namespaces == "Concerns" |
This file contains hidden or 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
require 'spec_helper' | |
describe Event do | |
let(:event) { FactoryGirl.create(:event) } | |
let(:summer_long_event) { FactoryGirl.create(:summer_long) } | |
describe '.summer_long' do | |
subject { described_class.summer_long } | |
it { should include(summer_long_event) } | |
it { should_not include(event) } |
This file contains hidden or 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 | |
clean() | |
{ | |
REMOTES="$@"; | |
if [ -z "$REMOTES" ]; then | |
REMOTES=$(git remote); | |
fi | |
REMOTES=$(echo "$REMOTES" | xargs -n1 echo) | |
RBRANCHES=() |
This file contains hidden or 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
exceptions = [] | |
tree = {} | |
ObjectSpace.each_object(Class) do |cls| | |
next unless cls.ancestors.include? Exception | |
next if exceptions.include? cls | |
next if cls.superclass == SystemCallError # avoid dumping Errno's | |
exceptions << cls | |
cls.ancestors.delete_if {|e| [Object, Kernel].include? e }.reverse.inject(tree) {|memo,cls| memo[cls] ||= {}} | |
end |