This file contains 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
sudo ifconfig en1 ether `openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'` |
This file contains 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
function ignoreRemoteUncaught(isUncaught, args, payload) { | |
try { | |
var filename = payload.data.body.trace.frames[0].filename; | |
if (isUncaught && !filename.match(/^https?:\/\/www\.mycompany\.com/)) { | |
// Ignore uncaught errors that are not from www.mycompany.com. | |
return true; | |
} | |
} catch (e) { | |
// Most likely there was no filename or the frame doesn't exist. | |
} |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script> | |
</head> | |
<body> | |
<div id="chart"></div> | |
<script type="text/javascript"> | |
var w = 800, h = 500; |
This file contains 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 -w | |
# brew-services(1) - Easily start and stop formulas via launchctl | |
# =============================================================== | |
# | |
# ## SYNOPSIS | |
# | |
# [<sudo>] `brew services` `list`<br> | |
# [<sudo>] `brew services` `restart` <formula><br> | |
# [<sudo>] `brew services` `start` <formula> [<plist>]<br> |
This file contains 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
# Sleep 5 tries to avoid Heroku truncating the output by terminating the connection before everything has transferred. | |
# Dump structure.sql as heroku_structure.sql | |
heroku run 'bundle exec rake db:structure:dump && cat db/structure.sql && sleep 5' --app app-name > db/heroku_structure.sql | |
# Dump schema.rb as heroku_schema.db | |
heroku run 'bundle exec rake db:schema:dump && cat db/schema.rb && sleep 5' --app app-name > db/heroku_schema.rb |
This file contains 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
test: | |
adapter: mysql2 | |
database: my_app_test | |
username: root | |
encoding: utf8 | |
cucumber: | |
adapter: mysql2 | |
database: my_app_test | |
username: root | |
encoding: utf8 |
This file contains 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
Factory.define :item do |f| | |
include ActionDispatch::TestProcess | |
f.name "Macbook Pro 15" | |
f.price_in_dollars 1500 | |
f.photo fixture_file_upload('/files/avatar.jpg', 'image/jpg') | |
end |
This file contains 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
var ngMin = require('broccoli-ng-min'); | |
var uglify = require('broccoli-uglify-js'); | |
var compileSass = require('broccoli-ruby-sass'); | |
var pickFiles = require('broccoli-static-compiler'); | |
var mergeTrees = require('broccoli-merge-trees'); | |
var findBowerTrees = require('broccoli-bower'); | |
var env = require('broccoli-env').getEnv(); | |
var compileES6 = require('broccoli-es6-concatenator'); | |
var app = 'app/scripts'; |
This file contains 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
# frozen_string_literal: true | |
namespace :db do | |
namespace :structure do | |
STRUCTURE_PATH = 'db/structure.sql' | |
def clean_structure_file | |
original = File.read(STRUCTURE_PATH) | |
cleaned = original.dup |
This file contains 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 "active_record" | |
ActiveRecord::Base.establish_connection("postgres:///db") | |
insert = Arel::Nodes::InsertStatement.new | |
insert.relation = Arel::Table.new(:movies) | |
insert.columns = hash.keys.map { |k| Arel::Table.new(:movies)[k] } | |
insert.values = Arel::Nodes::Values.new(hash.values, insert.columns) | |
ActiveRecord::Base.connection.execute(insert.to_sql) |
OlderNewer