Skip to content

Instantly share code, notes, and snippets.

View banane's full-sized avatar

Anna Billstrom banane

View GitHub Profile
@banane
banane / analyse_watchers.js
Last active February 24, 2016 17:16 — forked from DTFagus/analyse_watchers.js
Bookmarklet to analyse angular watchers
javascript: (function() {
var root = angular.element(document.getElementsByTagName('html'));
var watchers = [];
var attributes = [];
var attributes_with_values = [];
var elements = [];
var elements_per_attr = [];
var scopes = [];
@banane
banane / test.js
Created December 4, 2015 16:51
saving test
describe('exports a saving state', function(){
it('is saving in process', function(){
let ctrl = $controller('RequestController')
ctrl.request.body = "test"
ctrl.request.user = {id: 1}
ctrl.request.suggestion = {id: 2}
let promise = ctrl.save(ctrl.request)
expect(ctrl.saving).toEqual(true)
promise.error(function(data){
expect(ctrl.saving).toEqual(false)
@banane
banane / population.rb
Last active August 29, 2015 14:23
For a given set of populations, find the cities that add up to 100,000,000
require "colorize"
pops = [ 18897109, 12828837, 9461105, 6371773, 5965343, 5946800, 5582170, 5564635, 5268860, 4552402, 4335391, 4296250, 4224851, 4192887, 3439809, 3279833, 3095313, 2812896, 2783243, 2710489, 2543482, 2356285, 2226009, 2149127, 2142508, 2134411];
desired_total = 100000000
#pops = [-3, 0, 1,2,4,5,6,22,11]
#desired_total = 10
$results = []
def find_subset(numbers, target, partial=[])
//you don't need this:
arraylistYPositions.clear();
tempY = (int) btnCorrect.getY();
System.out.println("tempY: "+tempY);
arraylistYPositions.add(tempY);
tempY = (int) btnWrong1.getY();
System.out.println("tempY: "+tempY);
arraylistYPositions.add(tempY);
tempY = (int) btnWrong2.getY();
System.out.println("tempY: "+tempY);
@banane
banane / gist:a377ac300a9b5c1a0501
Created July 16, 2014 17:38
using layoutparams
private void adjustForLongerPhones(float density, int height){
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)petBioAndPhoto.getLayoutParams();
// check density
if(density > 1){
params.height = 830;
params.width = 640;
} else {
// for just bigger, low density phones...
if(height > 480){
@banane
banane / gist:5156514
Created March 13, 2013 21:32
errors when merged w/ master and re-run
1) AdminFlashSaleProducts searching for products for a Flash Sale can get to the correct flash sale from the Consignment page and can get back
Failure/Error: all("a[@href='#{main_app.edit_admin_flash_sale_path(@flash_sale.id)}']")[0].click
NoMethodError:
undefined method `click' for nil:NilClass
# ./spec/requests/admin/admin_flash_sale_products_spec.rb:78:in `block (3 levels) in <top (required)>'
2) Basic Functionality Tests checking for valid cases can add a product to cart (minicart)
Failure/Error: all("li#variant_#{@variant.id} a.mini-add-to-cart")[0].click
Selenium::WebDriver::Error::ElementNotVisibleError:
Element is not currently visible and so may not be interacted with
@banane
banane / gist:4718519
Created February 5, 2013 23:01
errors on picklist PR
1) Spree::Order#capture_partial_payment! should cause payments to complete, update totals, and payment state
Failure/Error: @order = create :order_with_totals_across_warehouses, ship_address: create(:address_in_california), state: 'complete'
Avalara::ApiError:
#<Avalara::Response::Invoice messages=[#<Avalara::Response::Message details="2/1/2013" severity="Error" source="Avalara.AvaTax.Services" summary="Your subscription to AvaTax services has expired. Please call Avalara at (206) 780-7000.">] result_code="Error">
# ./app/models/avalara/avalara_tax_transaction.rb:87:in `post_order_to_avalara'
# ./app/models/avalara/avalara_tax_transaction.rb:36:in `lookup'
# ./app/models/spree/order_decorator.rb:285:in `create_avalara_tax_adjustment'
# ./app/models/spree/order_decorator.rb:164:in `create_tax_charge!'
# ./spec/factories.rb:225:in `block (3 levels) in <top (required)>'
# ./spec/models/spree/order_decorator_spec.rb:113:in `block (3 levels) in <top (required)>'
http://199.193.199.85:8080/solr/select?fq=type%3ASpree%5C%3A%5C%3AProduct&fq=-clothing_size_im%3A%2829%29&fq=-shoes_size_im%3A%2814%29&start=0&rows=15&facet=true&f.taxon_ids_im.facet.mincount=1&facet.field=taxon_ids_im&facet.field=designer_id_i&facet.field=designer_name_s&facet.field=flash_sale_ids_im&facet.field=flash_sale_starts_at_dm&facet.field=flash_sale_ends_at_dm&facet.field=color_im&facet.field=clothing_size_im&facet.field=shoes_size_im&facet.field=condition_im&f.designer_id_i.facet.mincount=1&f.designer_name_s.facet.mincount=1&f.flash_sale_ids_im.facet.mincount=1&f.flash_sale_starts_at_dm.facet.mincount=1&f.flash_sale_ends_at_dm.facet.mincount=1&f.color_im.facet.mincount=1&f.clothing_size_im.facet.mincount=1&f.shoes_size_im.facet.mincount=1&f.condition_im.facet.mincount=1&q=%2A%3A%2A
@banane
banane / gist:4600653
Created January 23, 2013 00:56
errors from PR
1) AdminFlashSales visiting the admin panel home page validates inputs and preserves dates correctly for new Flash Sales
Failure/Error: page.should have_content("Starts #{(Date.today-1.day).strftime("%m/%d")} at 10:#{minute_start}AM #{Realreal::Config.default_time_zone_abbr}")
expected there to be content "Starts 01/21 at 10:18AM PST" in "RuntimeError at /admin/flash_sales\nPlease ensure the contemporary sale was initialized properly.\nApplication Frames All Frames\nFlashSale.find_contemporary_sale app/models/flash_sale.rb, line 257\n#<Class:0x007f94a1eb8ba0>#_2140c3dca1def4ac853d070f4fe8fca5 app/views/admin/flash_sales/index.html.erb, line 62\nCapybara::DiagnosticMiddleware#call lib/diagnostic_middleware.rb, line 13\nfind_contemporary_sale\napp/models/flash_sale.rb\n 252 \n 253 def self.find_contemporary_sale populate = true\n 254 contemporary_sales = FlashSale.where(:contemporary => true)\n 255 contemporary_sale = contemporary_sales.first\n 256 if contemporary_sale.nil?\n 2
@banane
banane / gist:4552322
Created January 17, 2013 00:20
error with gift card checkout
flow: put gift card in cart, place order
other products work
email may still be mis-configured
ArgumentError at /checkout/update/confirm
A sender (Return-Path, Sender or From) required to send a message
Application Frames All Frames
Spree::Order#finalize_with_referral_credits!
app/models/spree/order_decorator.rb, line 91
Spree::CheckoutController#update