Skip to content

Instantly share code, notes, and snippets.

View jhawthorn's full-sized avatar
⌨️

John Hawthorn jhawthorn

⌨️
View GitHub Profile
@jhawthorn
jhawthorn / smartconvert.rb
Created June 23, 2013 01:30
ffmpeg files, convert msmpeg4 to h264 in an mkv
#!/bin/ruby
require 'json'
class Video < Struct.new(:filename)
def info
@info ||= fetch_info
end
def streams; info['streams']; end
def vstream; streams.detect{|s| s['codec_type'] == 'video' }; end
@jhawthorn
jhawthorn / install.sh
Last active December 21, 2015 09:29
Installing IE VMs on ubuntu Needs 50-60 GB of free disk space
# Ensure VT-x is enabled in the BIOS
sudo apt-get install virtualbox unar
wget http://download.virtualbox.org/virtualbox/4.2.10/Oracle_VM_VirtualBox_Extension_Pack-4.2.10.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.10.vbox-extpack
curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | bash
# Wait a long time...
@jhawthorn
jhawthorn / spree_mailers.md
Last active December 21, 2015 23:19
Overriding spree mailers to deliver HTML

To override the existing text spree mailers, copy them into your application:

cp -r /path/to/spree/core/app/views/spree/{order,shipment}_mailer app/views/spree/

To add HTML versions create the following

  • app/views/spree/order_mailer/confirm_email.html.erb
  • app/views/spree/order_mailer/cancel_email.html.erb
  • app/views/spree/shipment_mailer/shipped_email.html.erb
@jhawthorn
jhawthorn / bundle.sh
Last active December 24, 2015 16:59
using vendor/bundle with spree
for dir in api backend core frontend sample .; do
mkdir -p "$dir/.bundle"
cat > "$dir/.bundle/config" << EOF
BUNDLE_DISABLE_SHARED_GEMS: '1'
BUNDLE_PATH: '`pwd`/vendor/bundle'
EOF
done
↳ RAILS_ENV=production rake environment
get("/spree/app_configuration/currency")
should_persist? false
= USD (fallback+saved)
get("/spree/app_configuration/currency")
should_persist? false
= USD (cached)
get("/spree/app_configuration/currency")
should_persist? false
= USD (cached)
require 'tempfile'
module Colbert
extend self
def generate_image file_path, text
on_notice = text.map(&:upcase)
text_width=350*1
text_height=50*1
$.each($('img'), function(){this.src="http://placekitten.com/g/"+$(this).width()+"/"+$(this).height()})
MSDOS 2.0 RELEASE
The 2.0 Release of MSDOS includes five 5 1/4 double density single sided
diskettes or three 8 iinch CP/M 80 format diskettes.
The software/documentation on the five inch diskettes is arranged
as follows:
1. DOS distribution diskette. This diskette contains files which
module Spree
module Stock
module Splitter
class OneItemPerPackage < Base
cattr_accessor :shipping_category_names do
[]
end
def split(packages)
packages_to_be_processed = packages.select do |package|