Skip to content

Instantly share code, notes, and snippets.

View searls's full-sized avatar
💚

Justin Searls searls

💚
View GitHub Profile
@searls
searls / wat.md
Last active August 27, 2015 22:56

UPDATE: @GordonDiggs figured it out. Args need the = sign, so the command should have been $ rake test TESTOPTS="--seed=23939"

When I run this:

$ rake test TESTOPTS="--seed 23939" 

I expect it to run with a certain seed, but instead I get

function turnNodeConfigIntoBrowserJs() {
var fs = require('fs');
var testEnvPath = 'tmp/test-environment.js';
var testEnv = require('../config/environment')('test');
fs.writeFileSync(testEnvPath, 'window.MY_APP_CONFIG = '+JSON.stringify(testEnv));
return testEnvPath;
}
var testSource = []
.concat([
package io.github.searls;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import io.github.searls.wrappers.ListShuffler;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;

Not syncing two macs

I've decided to experiment with maintaining two Macs for development (a clean, unblemished one to luxuriate over at home, and one to eventually run into the ground during my travels). The last time I did this was 2006. It was a fantastically frustrating experience and I gave up. I expect a similar outcome this time.

Here's the game plan:

  • Backup the original Mac to Time Machine
  • Wipe both new target Macs with a fresh OS X install, restore both from the same Time Machine backup (effectively "forking") the first computer's system image.
  • Have one Mac inherit the first's Time Machine backup and adopt its online Crashplan backup.
  • Start fresh backups for the other Mac. This required carefully deleting the /Library/Application Support/CrashPlan/.identity from the second Mac before ever allowing CrashPlan to launch (otherwise it'll log out the first Mac, start backing up, and confuse the hell out of CrashPlan)
@searls
searls / git-chown
Last active August 29, 2015 13:56
Handy script when you're moving a git repo from one github owner to another
#!/bin/bash -e
# Usage:
# $ git chown <repo name> <old owner> <new owner>
# Example:
# $ git chown lineman testdouble linemanjs
REPO_NAME=$1
OLD_OWNER=$2
NEW_OWNER=$3
@searls
searls / buggy-coffee.js
Created February 14, 2014 18:10
Whoops
/* jasmine-matcher-wrapper - 0.0.2
* Wraps Jasmine 1.x matchers for use with Jasmine 2
* https://github.com/testdouble/jasmine-matcher-wrapper
*/
(function() {
var __slice = [].slice,
__hasProp = {}.hasOwnProperty;
(function(jasmine) {
var comparatorFor;
@searls
searls / bad_idea.rb
Created March 3, 2014 20:46
Setting a default timestamp to "now" in postgresql
class CreateMessages < ActiveRecord::Migration
def change
create_table :messages do |t|
t.references :chat
t.text :content
t.timestamp :received_at, :default => "now"
t.timestamps
end
end
end

Keybase proof

I hereby claim:

  • I am searls on github.
  • I am searls (https://keybase.io/searls) on keybase.
  • I have a public key whose fingerprint is 0280 0082 D5BF E7DD 9225 E564 1699 DFA5 5B71 DFFB

To claim this, I am signing this object:

@searls
searls / server.js
Created March 21, 2014 15:22
server-route to read json from files. config/server.js
fs = require('fs')
module.exports = {
drawRoutes: function(app) {
app.get('/some-file', function(req, res){
res.json(JSON.parse(fs.readFileSync("config/spec.json").toString()));
});
}
};