Skip to content

Instantly share code, notes, and snippets.

View jasonlyles's full-sized avatar

Jason Lyles jasonlyles

View GitHub Profile
#! /bin/sh
echo "Installing play framework..."
cd /usr/lib
curl -O http://downloads.typesafe.com/play/2.2.6/play-2.2.6.zip
yum -y install unzip
unzip play-2.2.6.zip
rm -f play-2.2.6.zip
export PATH=$PATH:/usr/lib/play-2.2.6
cd play-2.2.6
chmod a+x play
FORM
= form_for @trip do |f|
%p
= add_paddler_kayak_link("Add a paddler", f)
.actions
= f.submit 'Save'
PADDLER_KAYAK PARTIAL
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
unless html_tag =~ /^<label/
%{<span class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message"> #{instance.error_message.first}</label></span>}.html_safe
else
#%{<span class="field_with_errors">#{html_tag}</span>}.html_safe
%{#{html_tag}}.html_safe
end
end
person:
height: 6'2"
weight: 210
age: 32
Product.create(:product_type => 'Instructions', :name => 'Rollback Tow Truck', :category_id => 1, :subcategory_id => 1, :product_code => 'CV001', :description => "Neat-o", :price => 3,:ready_for_public => true, :tweet => "100 characters or less, just because I have something that populates the rest of the tweet and takes 40 chars")
var stIsIE=false;sorttable={init:function(){if(arguments.callee.done){return }arguments.callee.done=true;if(_timer){clearInterval(_timer)}if(!document.createElement||!document.getElementsByTagName){return }sorttable.DATE_RE=/^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;forEach(document.getElementsByTagName("table"),function(A){if(A.className.search(/\bsortable\b/)!=-1){sorttable.makeSortable(A)}})},makeSortable:function(B){if(B.getElementsByTagName("thead").length==0){the=document.createElement("thead");the.appendChild(B.rows[0]);B.insertBefore(the,B.firstChild)}if(B.tHead==null){B.tHead=B.getElementsByTagName("thead")[0]}if(B.tHead.rows.length!=1){return }sortbottomrows=[];for(var A=0;A<B.rows.length;A++){if(B.rows[A].className.search(/\bsortbottom\b/)!=-1){sortbottomrows[sortbottomrows.length]=B.rows[A]}}if(sortbottomrows){if(B.tFoot==null){tfo=document.createElement("tfoot");B.appendChild(tfo)}for(var A=0;A<sortbottomrows.length;A++){tfo.appendChild(sortbottomrows[A])}delete sortbottomrows}headrow=B.tHead.
require 'mysql'
begin
cnnxn = Mysql.new(hostname_or_ip,user,password,database,3306,nil,Mysql::CLIENT_MULTI_RESULTS)
cnnxn.query_with_result = false
sql = "call name_of_stored_procedure"
cnnxn.query sql
no_more_results = false
until no_more_results
def update
params[:server][:network_interfaces].collect!{|x| NetworkInterface.new(x)}
@server = Server.find(params[:id])
respond_to do |format|
if @server.update_attributes(params[:server])
flash[:notice] = 'Server was successfully updated.'
format.html { redirect_to(@server) }
format.xml { head :ok }
else
require 'rest_client'
xml = <<-eos
<?xml version='1.0' encoding='UTF-8'?>
<server>
<id>20</id>
<hostname>steve</hostname>
<param-1>test1_update</param-1>
<param-2>test2_update</param-2>
<os>Windows</os>
module DataRepair
class DateValueArray
def self.fill_in_the_gaps(start_date,end_date,date_array,*value_array_temp)
date_array = date_array.reverse
value_array = []
value_array_temp.each{|v|value_array << v.reverse}
dates,values = [],[]
val_index = 0
num_of_values = ((Time.parse(end_date) - Time.parse(start_date)) / 86400).to_i + 1
num_of_values.times do |i|