Skip to content

Instantly share code, notes, and snippets.

View simplyb's full-sized avatar

Pete Broderick simplyb

View GitHub Profile
a = true unless defined? a
=> nil
unless defined? a
a = true
end
=> true
mix do deps.get, compile -v 16:09:41
Dependency resolution completed successfully
All dependencies up to date
==> bcrypt (compile)
ld: warning: directory not found for option '-L"/usr/local/Cellar/erlang/17.3.4/lib/erlang/lib/erl_interface-3.7.19/lib"'
ld: library not found for -lerl_interface
collect2: error: ld returned 1 exit status
ERROR: Command [compile] failed!
** (Mix) Could not compile dependency bcrypt, /usr/local/bin/rebar command failed. If you want to recompile this dependency, please run: mix deps.compile bcrypt
mix do deps.get, compile -v 15:26:00
Dependency resolution completed successfully
All dependencies up to date
==> bcrypt (compile)
ld: warning: directory not found for option '-L"/usr/local/Cellar/erlang/17.3.4/lib/erlang/lib/erl_interface-3.7.19/lib"'
ld: library not found for -lerl_interface
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: Command [compile] failed!
** (Mix) Could not compile dependency bcrypt, /usr/local/bin/rebar command failed. If you want to recompile this dependency, please run: mix deps.compile bcrypt
[capture_life] gcc --version 15:26:19
module.exports = function(req, res, next) {
if (!req.current_user.isAdmin()) {
req.body.owner_id = req.current_user.id;
}
return next();
};
var s = require('sails');
s.load({
environment: 'production',
log: {
level: 'info'
},
hooks: {
blueprints: false,
controllers: false,
require 'spec_helper'
describe SimplySettings do
before do
Rails.cache.clear
end
subject(:settings) { SimplySettings }
@simplyb
simplyb / ridiculous.js
Created November 26, 2013 16:49
absolute ridiculousness
function getSelection()
{
// returns null, or a structure containing startPoint and endPoint,
// each of which has node (a magicdom node), index, and maxIndex. If the node
// is a text node, maxIndex is the length of the text; else maxIndex is 1.
// index is between 0 and maxIndex, inclusive.
if (browser.msie)
{
var browserSelection;
try
@simplyb
simplyb / gist:7550368
Last active December 28, 2015 19:29 — forked from cupakromer/gist:7550244
# The idea here is that if any of the three tokens are not already
# set, then they should be generated. In order to generate one, it
# must be unique.
def generate_tokens!
[ :code, :access_token, :refresh_token ].each do |attr|
next if send(attr)
send "#{attr}=", tokenize(attr)
end
end
require 'performance_helper'
require 'benchmark'
describe UsersController, :type => :controller do
context "index performance" do
it 'should be fast' do
Benchmark.realtime{
get :index, :format => :json
RSpec.configure do |config|
...
config.use_transactional_fixtures = true
#seed the database before the test suite runs
config.before(:suite) do
load "#{Rails.root}/db/performance_data.rb"
end
...
end