Skip to content

Instantly share code, notes, and snippets.

View JonCrawford's full-sized avatar
🏗️
Helping startups on product, tech & UX

Jonathan Crawford JonCrawford

🏗️
Helping startups on product, tech & UX
View GitHub Profile
@JonCrawford
JonCrawford / sql_queries.sql
Created October 30, 2014 00:13
Vanity ID SNAFU Recovery
SELECT orders.id, orders.vanity_id, orders.payment_state, orders.confirmed_at, orders.store_id, store_subdomain from orders WHERE orders.vanity_id < 100000 and orders.confirmed_at > DATE_SUB(NOW(), INTERVAL 5 DAY) AND orders.store_id IN (528222, 18784) order by vanity_id, store_id;
/* =General
----------------------------------------------*/
body {
margin: 0 auto;
font-size: 13px;
line-height:1.5;
background-position:center top;
}
#wrapper {
/*----------------------------------------------------------------------------------------
= USER BAR
------------------------------------------------------------------------------------------*/
#user_bar {
height: 25px;
margin-right:10px;
position:absolute;
top:0;
width:572px;
right:10px;
actionmailer (2.1.0, 1.3.6, 1.3.3)
actionpack (2.1.0, 1.13.6, 1.13.3)
actionwebservice (1.2.6, 1.2.3)
activerecord (2.1.0, 1.15.6, 1.15.3)
activeresource (2.1.0)
activesupport (2.1.0, 1.4.4, 1.4.2)
acts_as_ferret (0.4.1)
aws-s3 (0.5.1, 0.5.0)
builder (2.1.2)
capistrano (2.4.3, 2.0.0)
def american_apparel_2001_colors
["Aqua","Army","Ash Grey (no xs)","Ash White Stripe (no xs)","Asphalt","Baby Blue","Black","Brown","Cranberry",
"Creme","Eggplant","Forest","Fuchsia","Gold","Grass","Heather Grey ","Kelly Green ","Lapis (no xs)","Lemon",
"Light Blue","Light Pink","Lime","Mint","Navy","New Silver","Olive","Orange","Pink","Purple","Raspberry ",
"Red","Royal Blue","Sea Foam ","Slate","Teal","White"]
end
def american_apparel_girls_colors
["Aqua","Army (no 2xl)","Ash Grey (no 2xl)","Ash White Stripe (no 2xl)","Asphalt(no 2xl)","Baby Blue","Black",
module PrintingHelper
def other_position
["Left Sleeve","Right Sleeve","Left Side", "Right Side",["Other (explain in notes)","Other"]]
end
def position_options(selected = nil, prompt = nil)
groups = ["Front Tshirt", "Back Tshirt", "Other"]
options = [
["Full Front","Center Chest","Left Breast","Right Breast", "Lower Left", "Lower Right", "Lower Center"],
<div class="product_row add_new_product" id="new_design">
<a href="#" onclick="try {
new Insertion.Before(&quot;new_design&quot;, &quot;\n&lt;div class=\&quot;product_row add_new_product\&quot; id=\&quot;new_product\&quot;&gt;\n &lt;a href=\&quot;#\&quot; onclick=\&quot;try {\nnew Insertion.Before(&quot;new_product&quot;, &quot;&lt;p&gt;This works.&lt;/p&gt;&quot;);\n} catch (e) { alert('RJS error:\\n\\n' + e.toString()); alert('new Insertion.Before(\\&quot;new_product\\&quot;, \\&quot;&lt;p&gt;This works.&lt;/p&gt;\\&quot;);'); throw e }; return false;\&quot;&gt;Add another product&lt;/a&gt;&lt;/div&gt;&quot;);
} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('new Insertion.Before(\&quot;new_design\&quot;, \&quot;\\n&lt;div class=\\\&quot;product_row add_new_product\\\&quot; id=\\\&quot;new_product\\\&quot;&gt;\\n &lt;a href=\\\&quot;#\\\&quot; onclick=\\\&quot;try {\\nnew Insertion.Before(&quot;new_product&quot;, &quot;&lt;p&gt;This works.&lt;/p&gt;&quot;);\\n} catch (e) { alert(\'
def optgroups_with_options(groups, options, selected = nil, prompt = nil)
return "<option>Error: Sizes don't match.</option>" if groups.size != options.size
str = String.new
unless prompt.nil?
if prompt.is_a? String
str += content_tag :option, prompt, :value => ""
elsif prompt.is_a? Array
str += content_tag( :option, prompt[0], :value => prompt[1])
end
end
## Tests
def test_grouped_options_for_select_with_array
assert_dom_equal(
"<optgroup label=\"North America\"><option value=\"US\">United States</option>\n<option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"GB\">Great Britain</option>\n<option value=\"Germany\">Germany</option></optgroup>",
grouped_options_for_select([
["North America",
[['United States','US'],"Canada"]],
["Europe",
[["Great Britain","GB"], "Germany"]]
])
str = "So don't return this (but do return this)"
start = str.index("(")+1
stop = str.rindex(")")-1
str[start..stop]