Skip to content

Instantly share code, notes, and snippets.

View changemewtf's full-sized avatar

Max C changemewtf

View GitHub Profile
/* Your code starts here */
/*
1. structure app
2. create events (controllers)
3. create Model/View
4. render view
*/
var app = app || {};
@changemewtf
changemewtf / app.js
Created October 14, 2014 22:41
Favorite ice cream flavors
angular.module('icecream', []).
controller('IceCreamController', function() {
this.flavors = [
'vanilla',
'chocolate',
'neopolitan',
'green tea'
];
@changemewtf
changemewtf / seed.rb
Created October 16, 2014 20:40
Auto-clear database on rake db:seed
# db/seed.rb
# This block will automatically empty the database every time db:seed is run.
ActiveRecord::Base.connection.tables.each do |table|
# Don't clear our migration history! Clear everything else.
if table != 'schema_migrations'
# http://stackoverflow.com/a/7758797
ActiveRecord::Base.connection.execute("TRUNCATE TABLE #{table};")
# http://stackoverflow.com/questions/2097052/rails-way-to-reset-seed-on-id-field
ActiveRecord::Base.connection.reset_pk_sequence! table
@changemewtf
changemewtf / testem.rb
Created October 21, 2014 20:12
Little test scaffold for Project Euler problems.
if __FILE__ == $0
require 'minitest/autorun'
require 'benchmark'
require 'logger'
output = StringIO.new
logger = Logger.new output
logger.formatter = ->(severity, datetime, progname, msg) { msg + "\n" }
describe "solution" do
/Users/mcantor/.rbenv/versions/2.1.2/bin/ruby -I"lib:lib:test" -I"/Users/mcantor/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib" "/Users/mcantor/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "test/**/*_test.rb"
adding: test/data/file2.txt (deflated 79%)
deleting: test/data/file2.txt
zip warning: zip file empty
adding: test/data/generated/longAscii.txt (deflated 80%)
adding: test/data/generated/empty.txt (stored 0%)
adding: test/data/generated/empty_chmod640.txt (stored 0%)
adding: test/data/generated/short.txt (stored 0%)
adding: test/data/generated/longBinary.bin (deflated 90%)
enter new zip file comment (end with .):
now how about this program:
puts "meow"
def dog
puts "BARK"
end
puts "meow"
@changemewtf
changemewtf / quote.md
Last active September 28, 2015 21:01
Annie Dillard -- The Writing Life

One of the few things I know about writing is this:

Spend it all, shoot it, play it, lose all, right away, every time.

Do not hoard what seems good for a later place in the book, or for another book; give it, give it all, give it now.

The impulse to save something good for a better place later is the signal to spend it now. Something more will arise for later, something better.

These things fill from behind, from beneath, like well water.

def print_new_line
print "\n"
end
def print_a_number
value = 100
print value
print_new_line()
end
@changemewtf
changemewtf / defense.md
Last active December 8, 2015 23:19
Defending against online abuse and identity theft

Speak Up & Stay Safe on FeministFrequency is another good resource.

STEP ONE: PASSWORDS

These steps will prevent people from breaking into your accounts by exploiting weak passwords or weak storage.

Remember that even if you have good passwords, most people re-use passwords. So if you use the same password for your e-mail and some random website, and the random website gets hacked, the hacker now has your e-mail and the password.

  1. Download 1Password or something like it
  2. Come up with a good master pass-phrase that can be typed like an English sentence (like "This is my password.")
Fantasy Colors
--------------
[BLACK_R:0]
[BLACK_G:0]
[BLACK_B:0]
[BLUE_R:46]
[BLUE_G:27]
[BLUE_B:148]