Skip to content

Instantly share code, notes, and snippets.

@mikepmunroe
mikepmunroe / git-prune.txt
Created November 13, 2018 14:50
prune local git repos that have been merge into master
git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d
- from https://stackoverflow.com/questions/13064613/how-to-prune-local-tracking-branches-that-do-not-exist-on-remote-anymore
#put in lib/tasks/fixtures.rake
namespace :db do
namespace :fixtures do
desc 'Create YAML test fixtures from data in an existing database.
Defaults to development database. Set RAILS_ENV to override.'
task :dump => :environment do
sql = "SELECT * FROM %s"
skip_tables = ["schema_migrations"]
ActiveRecord::Base.establish_connection(:development)
(ActiveRecord::Base.connection.tables - skip_tables).each do |table_name|
@mikepmunroe
mikepmunroe / ember_cli_upgrade
Created June 2, 2014 23:24
Ember CLI upgrade
https://twitter.com/stefanpenner/status/466570444246884352
upgrade protip:
1. cd your-project
2. npm update ember-cli —save
3. ember init
4. use “d” to view diffs
5. git to adjust overwrites
@mikepmunroe
mikepmunroe / user_info
Created March 19, 2014 16:49
Rake task to pull emails for sample users
namespace :breakpointapp do
desc 'Prints emails for sample users to the console'
task :user_info => [:environment] do
unless Rails.env.development?
raise 'This task can only be run in the development environment'
end
puts User.pluck(:email)
end
end
@mikepmunroe
mikepmunroe / eak_fixture.js
Created November 14, 2013 01:27
EAK fixture definition example
var User = DS.Model.extend({
name : DS.attr('string'),
email : DS.attr('string'),
creationDate : DS.attr('date')
});
User.reopenClass({
FIXTURES: [
{
id: "1",
@mikepmunroe
mikepmunroe / logout.js
Created September 19, 2013 00:00
Invoke log out in an ember test for breakpoint app
Ember.run ->
getApplicationController().unauthenticate()
$.removeCookie("auth_user")
$.removeCookie("access_token")
@mikepmunroe
mikepmunroe / launch_mongo
Created August 1, 2013 17:21
Launch mongo
To have launchd start mongodb at login:
ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
Then to load mongodb now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Or, if you don't want/need launchctl, you can just run:
mongod
@mikepmunroe
mikepmunroe / capped ls
Created February 6, 2013 14:53
Return a list of most recent files in a linux directory, capped by the number of files you want returned. In this example, I capped the results at 10, but you can change 'head -10' to whatever you want. 'tail -n +2' cuts off the number of results that would show at the top of the files returned.
ls -l -t | tail -n +2 | head -10
@mikepmunroe
mikepmunroe / gist:4717160
Created February 5, 2013 20:01
Quick and dirty Drupal 6 watchdog example that outputs $var data with the message
watchdog('module name', 'message information' . var_export($var, TRUE), WATCHDOG_INFO);
@mikepmunroe
mikepmunroe / about.md
Created August 9, 2011 16:55 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer