Skip to content

Instantly share code, notes, and snippets.

template = "Element #{item} in the array."
array = ['a', 'b', 'c']
text = array.map {|item| template}
@binaryphile
binaryphile / tel-tabular.css
Last active December 15, 2015 20:49
tel-tabular
/* Basic tabular structure */
.tel-tabular {
border-collapse: collapse;
margin-bottom: 1em;
display: table;
width: 100%;
}
.tel-tabular > div, .tel-tabular > li {
display: table-row-group;
width: 100%;
@binaryphile
binaryphile / gist:4348104
Created December 20, 2012 20:00
Output of running vagrant up with the Spree Vagrantfile
[default] Importing base box 'precise64lts'...
[default] [default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.
Guest Additions Version: 4.1.18
VirtualBox Version: 4.2.4
[default] Matching MAC address for NAT networking...
@binaryphile
binaryphile / Vagrantfile
Created December 11, 2012 16:30
vagrantfile
Vagrant::Config.run do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64lts"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
#config.vm.box_url = "http://dl.dropbox.com/u/1537815/precise64.box"
# Boot with a GUI so you can see the screen. (Default is headless)
27 Started PUT "/admin/orders/R814805045/payments/346/fire?e=capture"
28 Processing by Spree::Admin::PaymentsController#fire as HTML
29 Parameters: [...]
30 Redirected to https://store.diditbetter.com/admin/orders/R814805045/payments
31 Completed 500 Internal Server Error in 2463ms
32
33 StateMachine::InvalidTransition (Cannot transition state via :failure from "checkout" (Reason(s): State cannot transition via "failure")):
34 vendor/bundle/ruby/1.9.1/gems/state_machine-1.1.2/lib/state_machine/event.rb:241:in `block in add_actions'
35 vendor/bundle/ruby/1.9.1/gems/state_machine-1.1.2/lib/state_machine/machine.rb:753:in `call'
[...]
@binaryphile
binaryphile / gist:3881634
Created October 12, 2012 21:30
deface set attributes data-erb-class
set_attributes '[data-hook=product_price]'
attributes :data-erb-class => 'columns five <% if [email protected]_variants? %> alpha <% else %> omega <% end %>'
@binaryphile
binaryphile / gist:3841499
Created October 5, 2012 18:22
spree deployment service
err: Could not prefetch mysql_database provider 'mysql': #<IO:0xb70c0848>
err: /Stage[main]/Dbserver/Mysql::Database[spree]/Mysql_database[spree]: Could not evaluate: Execution of '/usr/bin/mysql mysql -NBe show databases' returned 1: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
@binaryphile
binaryphile / one-handed.ahk
Created August 31, 2012 17:38
Simple One-handed Keyboard Autohotkey script
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Recommended for catching common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Toggle := False
$Space::
KeyWait, Space, T0.15 ; Adjust this value to control the delay before switching modes
If ErrorLevel
@binaryphile
binaryphile / gist:3536938
Created August 30, 2012 18:35
deface override
Deface::Override.new(virtual_path: 'spree/checkout/_payment',
name: 'add_referral_select_to_checkout_payment_step',
insert_before: 'fieldset#payment',
text: '<fieldset id="billing"><legend><%= t(:referral) %></legend><div><p>If you were referred to us by one of our salespeople, please select their name:</p><%= form.collection_select :dibs_referral, Spree::User.all, :id, :email %></div></fieldset>'
)
module Spree
Order.class_eval do
@binaryphile
binaryphile / gist:3500552
Created August 28, 2012 16:54
Autohotkey use Esc as modifier script
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other <[email protected]>
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
; This script uses Esc as a modifier key so that the keyboard can be used for directional keys (arrows, etc.)