Skip to content

Instantly share code, notes, and snippets.

@lgrains
lgrains / gist:e6c660bed68dfe1862a2
Created June 29, 2015 20:19
problems installing librsvg
brew install librsvg
==> Installing dependencies for librsvg: fontconfig, pixman, cairo, libcroco, icu4c, harfbuzz, pango
==> Installing librsvg dependency: fontconfig
==> Downloading https://homebrew.bintray.com/bottles/fontconfig-2.11.1.yosemite.bottle.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/fontconfig-2.11.1.yosemite.bottle.3.tar.gz
==> Pouring fontconfig-2.11.1.yosemite.bottle.3.tar.gz
Error: Permission denied - /usr/local/var/cache
Warning: Bottle installation failed: building from source.
==> Downloading http://fontconfig.org/release/fontconfig-2.11.1.tar.bz2
Already downloaded: /Library/Caches/Homebrew/fontconfig-2.11.1.tar.bz2
@lgrains
lgrains / gist:6d964fb775cc2694fe9e
Created June 29, 2015 20:17
squib installation problems
gem install squib
Building native extensions. This could take a while...
ERROR: Error installing squib:
ERROR: Failed to build gem native extension.
/Users/louiserains/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20150629-66096-vrc64y.rb extconf.rb
checking for --enable-debug-build option... no
checking for -Wall option to compiler... yes
checking for -Waggregate-return option to compiler... yes
checking for -Wcast-align option to compiler... yes
rspec string_calculator.rb
.....F
Failures:
1) add negative number(s)
Failure/Error: raise "negatives not allowed - " + v.to_s if v
RuntimeError:
negatives not allowed - -3
# ./string_calculator.rb:6:in `add'
@lgrains
lgrains / Test Plan
Created May 14, 2014 00:59
Test Plan to verify that the Orders pages show the correct course names over time.
Test plan for the Orders page:
Use the following link for orders (replace the order_id):
https://testing.berkleemusic.com/store/admin/orders/one?order_id=13453427
The expected name for BMB-125 is shown below. Make sure that it shows up on payments, items and vouchers.
12058228 Music Marketing: Press, Promotion, Distribution, and Retail (MM:PPDR)
9775405 MM:PPDR
3119453 Music Marketing 201
14277150 Music Marketing 101
13453427 Music Marketing 101
13676052 Music Marketing 101
@lgrains
lgrains / get_historical_name
Created May 14, 2014 00:57
This psql function returns the historical name of a course, given the term and item number.
--Function parameters: cart_item_id (ec_items)
product_name (ec_products)
--returns the title of the course at that point in time.
create or replace function public.get_historical_name ( integer, varchar )
returns varchar as '
declare
v_cart_item_id alias for $1;
v_product_name alias for $2;
@lgrains
lgrains / irb_session.rb
Created May 12, 2014 13:41
IRB session using the kdtree gem
>> require 'kdtree'
true
>> point_array = [ [3,5],[14,0],[0,3],[-5,6],[-2,-3],[-4,-7],[2,-5],[0,0] ]
[
[0] [
[0] 3,
[1] 5
],
[1] [
[0] 14,
@lgrains
lgrains / quadtree_pseudocode.rb
Last active July 26, 2021 12:14
Pseudo-code for Quadtree Implementation
class Point
attr_accessor :x, :y
end
class QuadtreeNode
attr_accessor :point, :name
def northwest(other)
self.point.x > other.point.x && self.point.y < other.point.y
end
class Graph
attr_accessor :points, :edges
def initialize(array_of_points)
points = Marshal.load(Marshal.dump(array_of_points))
puts "in initialize where graph.points is #{points}"
edges=[]
construct_edges
end
require 'spec_helper.rb'
require 'lib/sf_to_coll/convert.rb'
require 'rake'
describe SfToColl::Convert do
context "main file for single record should be 2186 chars long" do
Rake::Task["import_field_data"].invoke
let(:converter){ SfToColl::Convert.new("tmp/ctbrown.csv").process }
let(:out_file_name){ converter.out_file_name }
module Euler
class Prob1
def self.sum(upper_limit, num1, num2)
::Prob1.new(upper_limit, num1, num2).sum
end
def initialize(upper_limit, num1, num2)
puts "#{upper_limit} | #{num1} #{num2}"