Skip to content

Instantly share code, notes, and snippets.

View jhawthorn's full-sized avatar
⌨️

John Hawthorn jhawthorn

⌨️
View GitHub Profile
HTMLFILES=www/index.html $(wildcard www/articles/*.html)
TXTFILES=$(wildcard www/*.html)
CSSFILES = $(wildcard www/assets/*.css)
HTMLTARGETS=$(HTMLFILES:www/%.html=build/%.html)
all: build
node_modules:
npm install minify

We need an improvement to our architecture to allow us to test portions of spree more easily. However I believe we will always need working complete factories form, at least for integration tests.

Regardless of what we're to do in the future. I thought it may be useful to document why all these queries are currently run, and what options we have to reduce their number.

[1] pry(#)> create(:line_item)
Spree::Image.attachment_definitions[:attachment].update(
s3_credentials: {
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
bucket: ENV['S3_BUCKET_NAME']
},
storage: :s3,
s3_headers: { "Cache-Control" => "max-age=31557600" },
s3_protocol: "https",
@jhawthorn
jhawthorn / capybara_profile.rb
Created February 12, 2015 19:25
Throw this in spec/support and run specs as normal. Stackprof will output a profile to the tmp directory.
Capybara.app = Rack::Builder.new do
map "/" do
use StackProf::Middleware,
enabled: true,
mode: :wall,
interval: 100,
save_at_exit: true
run Rails.application
end
end.to_app
@jhawthorn
jhawthorn / drake_game.md
Last active February 17, 2023 06:09
Parking Spotting

Points given for people parking in smartcar spot outside of the drake

points
100 Actual smart car
150 Motorbike
50 SUV or minivan
25 Regular car
75 Truck
#!/usr/bin/env ruby
class Example
attr_reader :spec_name, :status
def initialize(example_id, status, run_time, _)
@example_id = example_id
@status = status
@run_time = run_time
end
end
@jhawthorn
jhawthorn / particle_temperature_sensor.cc
Created November 16, 2015 01:14
A wifi temperature sensor using a particle photon
// This #include statement was automatically added by the Particle IDE.
#include "Particle-OneWire/Particle-OneWire.h"
// This #include statement was automatically added by the Particle IDE.
#include "particle-dallas-temperature/particle-dallas-temperature.h"
// Init Dallas on pin digital pin 6
DallasTemperature dallas(new OneWire(D6));
SELECT DISTINCT "spree_shipping_methods".*
FROM "spree_shipping_methods"
INNER JOIN "spree_shipping_method_categories"
ON "spree_shipping_method_categories"."shipping_method_id" =
"spree_shipping_methods"."id"
INNER JOIN "spree_ship ping_method_zones"
ON "spree_shipping_method_zones"."shipping_method_id" =
"spree_shipping_methods"."id"
INNER JOIN "spree_zones"
ON "spree_zones"."id" = "spree_shipping_method_zones"."zone_id"
bundle exec rspec $(ag -s binding.pry spec | sed 's/^\([^:]*:[0-9]*\):.*$/\1/g')
set -e
git_changed() {
changes=$(git diff)
[ -n "$changes" ]
}
find spec -name '*_spec.rb' | xargs sed -i 's/spree_\(get\|post\|put\|delete\)/\1/g'
if git_changed; then
git commit -am 'Use normal get/post/put/delete test helpers' || true