Skip to content

Instantly share code, notes, and snippets.

View LBRapid's full-sized avatar
🏠
Working from home

John Dyer LBRapid

🏠
Working from home
View GitHub Profile
require 'bundler'
Bundler::GemHelper.install_tasks
require 'rspec/core/rake_task'
require 'spree/testing_support/extension_rake'
RSpec::Core::RakeTask.new
task :default => [:spec]
POST /v2/1345278/cart HTTP/1.1
Host: event.jirafe.com
Content-Type: application/json
Authorization: Bearer 7fa98a9b9040e6388b69cf2c02b87885c9073a77
{
"id": "8797436543010",
"create_date": "2013-06-17T15:16:10.000Z",
"change_date": "2013-06-17T15:16:15.000Z",
"subtotal": 99.85,
@LBRapid
LBRapid / Rakefile
Created October 15, 2013 14:33
Using sprockets outside of rails
require 'rubygems'
require 'sprockets'
task :default => [:release]
desc "Release the application"
task :release do
puts "Compiling JavaScript assets...hang tight!"
project_root = File.expand_path(File.dirname(__FILE__))
assets = Sprockets::Environment.new(project_root)
def config_as_param_hash
{
'rlm.csv_target_bucket' => 'dev-bucket',
'rlm.aws_access_key_id' => 'abc',
'rlm.aws_secret_access_key' => 'cded',
'rlm.shipping_map' => [{"Overnight"=>"FXN", "International"=>"FXI", "Alaska & Hawaii"=>"FSP", "US-3-DAY" => "FX3"}],
'rlm.ground_shipping_map' => [{"Montana"=>"FXG", "Wyoming" => "FXG"}],
'rlm.options_mapping' => [{"size" => "size", "color" => "color"}]
}
end
{
"name": "rlm",
"display": "RLM Endpoint",
"description": "Endpoint that saves order lines locally to be exported into RLM CSV to S3",
"help": "http://guides.spreecommerce.com/integration/endpoints/rlm_endpoint",
"consumers": [
{
"name": "persist",
"path": "/lines/persist",
"description": "Saves line_items locally to export.",
  • Install Xcode (App Store)
  • Install command line tools (Xcode preferences > Additional downloads)
  • Install Homebrew
<form action="#">
<section class="modal-body">
<div id="modal-tabs">
$ ->
class ParametersForm
constructor: (el) ->
@el = $(el)
@setupEventHandlers()
@
setupEventHandlers: ->
@el.find('#parameter_data_type').change ->
if $(@).val() == 'list'
@LBRapid
LBRapid / Guardfile
Created July 3, 2013 14:37
Guardfile guard-sprockets example
guard 'sprockets', :destination => 'public',
:asset_paths => ['app/assets/javascripts', 'vendor/assets/javascripts'],
:root_file => 'app/assets/javascripts/application.js', :minify => true do
watch(%r{^app/assets/javascripts/(.+)\.(js|js\.coffee)})
end
@LBRapid
LBRapid / precompile.rake
Last active December 19, 2015 07:19
Precompile javascript assets in a rails engine
namespace :assets do
ROOT = Pathname.new(File.dirname(__FILE__))
LOGGER = Logger.new(STDOUT)
APP_ASSETS_DIR = ROOT.join("app/assets")
PUBLIC_ASSETS_DIR = ROOT.join("vendor/assets")
OUTPUT_DIR = ROOT.join("public")
desc 'Compile assets'
task :compile => :compile_js