Skip to content

Instantly share code, notes, and snippets.

<form accept-charset="UTF-8" action="/suppliers/6/products/38" class="edit_product" data-remote="true" id="edit_product_38" method="post" name="edit_product_38">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="&acirc;&oelig;&ldquo;"><input name="_method" type="hidden" value="put"><input name="authenticity_token" type="hidden" value="K5dKVuoTllzbCT5uJkWuHAoUsayE4Z5irFjXcuP2dME=">
</div>
<p><label for="product_name">Name</label> <input id="product_name" name="product[name]" size="30" type="text" value="Bacon Streaky Precooked"></p>
<p><label for="product_item_number">Item number</label> <input id="product_item_number" name="product[item_number]" size="30" type="text" value="40656"></p>
<p><label for="product_carton_quantity">Carton quantity</label> <input id="product_carton_quantity" name="product[carton_quantity]" size="30" type="text" value="4x1kg"></p>
<p><label for="product_uom">UOM</label> <input id="product_uom" name="product[uom]" si
@daz
daz / gist:1136395
Created August 10, 2011 08:47
Using Ruby to schedule jobs with UNIX `at` command
time = Time.now + 60
queue_command = <<-CMD
at -t #{time.strftime('%Y%m%d%H%M')} <<-AT
echo "ran at #{time}" > output.txt
CMD
system queue_command
@daz
daz / php-cgi.rb
Created September 24, 2011 09:33 — forked from ambethia/php-cgi.rb
Homebrew Formula for PHP 5.2.17 as php-cgi (for nginx, etc.)
# Homebrew Formula for PHP 5.2.17 as php-cgi (for nginx, etc.)
require 'formula'
class PhpCgi <Formula
@url='http://www.php.net/get/php-5.2.17.tar.bz2/from/a/mirror'
@version='5.2.17'
@homepage='http://php.net/'
@md5='575551f5df56b9311e932b3a098c2e7a'
@daz
daz / gist:3095875
Created July 12, 2012 04:50
Nice web type
@daz
daz / _menu.html.erb
Created September 4, 2012 05:14
Bootstrap dropdown menu with Rails and Ancestry
<% if article.is_childless? %>
<li><%= link_to article.title, article_path(article) %></li>
<% else %>
<li class="dropdown">
<%= link_to '#', class: 'dropdown-toggle', data: { toggle: 'dropdown'} do %>
<%= article.title %>
<b class="caret"></b>
<% end %>
<ul class="dropdown-menu">
<%= render partial: 'site/menu', collection: article.children, as: :article %>
@daz
daz / appleevent.rb
Created September 13, 2012 04:09
Watch for Apple event video posting
#!/usr/bin/ruby
# encoding: utf-8
# Pings Apple events page until the video is posted
# Videos are usually live ~6 hours after official start time
#
# $ git clone https://gist.github.com/3711799.git appleevent
# $ ruby appleevent/appleevent.rb
require 'date'
@daz
daz / gist:3713077
Created September 13, 2012 09:07
Get up and going in Rails
# install textmate
https://github.com/textmate/textmate/downloads
# install command line tools for mountain lion
# need this for homebrew apparently
https://developer.apple.com/downloads/index.action
# change shell to zsh
# has better tab completion and makes terminal easier
chsh -s /bin/zsh
class Employee
PAY_RATES = [1, 6, 7.80]
def pay_rate
case age
when 0..15
PAY_RATE[0]
when 15..16
PAY_RATE[1]
@daz
daz / gist:4959756
Last active December 13, 2015 18:59 — forked from ash37/gist:4959753
def display_address_title(employee)
if employee.address.empty?
''
else
'<b>Address</b>'
end
end
@daz
daz / f1calendar.rb
Last active December 14, 2015 14:59
Formula1 calendar script. P1-3, qualifying. and race start times for the year
# Dependencies
#
# $ gem install icalendar
#
# Usage
#
# $ git clone https://gist.github.com/5104840.git f1calendar
# $ ruby f1calendar/f1calendar.rb
#
# FORMULA 1 GRANDE PRÊMIO DO BRASIL 2015 - Sao Paulo - 2015-11-13 12:00:00 UTC - Practice 1