Skip to content

Instantly share code, notes, and snippets.

View pumpchaser's full-sized avatar

Huy pumpchaser

  • Los Angeles, CA
View GitHub Profile
Step 16/16 : RUN ./bin/setup
---> Running in ec4a9cacc432
== Installing dependencies ==
The Gemfile's dependencies are satisfied
yarn install v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
import { combineReducers } from 'redux'
const subscribed = (state = false, action) => {
switch (action.type) {
case 'SET_SUBSCRIBED':
return true
default:
return state
}
}
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
FF.F..FFFF.F.FFFFFF.
Failures:
1) Rtesseract::BoxChar bounding box by char
Failure/Error: expect(RTesseract::BoxChar.new(@image_tiff).characters.is_a?(Array)).to eql(true)
Magick::ImageMagickError:
no decode delegate for this image format `TIFF' @ error/constitute.c/ReadImage/501
$.ajax({
type: 'GET',
url: '/topics/savings_easter_egg',
data: {
savings: data[key]['saving']
} ,
success: function(response) {
$(response).dialog({
height: 840,
def compute_packages
packages = Packages.all # or however you get all your package
items = get_items #array of items
packages.each do |old_package|
items.each do |item|
old_package << item if old_package #if it has space (true), add the item
items.delete item if old_package #delete item, not sure if you can make this call inside of an iteration block
break if !old_package
end
require 'spec_helper'
describe 'CheckPrice', type: :request, js: true do
it "should create a new CheckPrice record when user clicks Check Price on topic page" do
city = create :city, name: "Bilboa", country: create(:country, name: "USA")
partner_restaurant = create :partner_restaurant
restaurant = create :restaurant, name: 'McDonalds', city: city, contact_phone: "123-123-1234"
matched_restaurant = create :matched_restaurant, restaurant: restaurant, partner_restaurant: partner_restaurant
visit '/mcdonalds-bilboa-restaurant' #this link does not have the check prices button
factory :restaurant do
name { Faker::Name.first_name }
city
end
factory :matched_restaurant do
association :partner_restaurant
association :restaurant
end
#strip phone number in partner_restaurant of non-numeric values
formatted_phone = SunspotHelper.sanitize_term(pr.phone).gsub(/\s+/, "")
#When iterating through each restaurant in DB,
#I want to strip all contact_phone of non-numeric values as well before checking against formatted_phone
Restaurant.where(contact_phone: formatted_phone).each do |r|
#irrelevant code
end
def new
begin
@slug = params[:slug_text]
@place = Slug.where(name: @slug).first.sluggable
@klass = @place.class
rescue Exception => e
redirect_to :root
end
end
@pumpchaser
pumpchaser / javascript
Created October 11, 2012 04:30
Form_for multiple selections into an array
$('#hotel_categories').change(function(){
value = $(this).val();
$('#appended_wrapper').append( '<div class="appended"> '+value+' <a class="remove" href="#">Remove</a></div>' );
$('.remove').click(function(){
$(this).parent(".appended").remove();
});