Skip to content

Instantly share code, notes, and snippets.

View fivetwentysix's full-sized avatar
💭
yet another programmer

Patrick Ma fivetwentysix

💭
yet another programmer
View GitHub Profile
class Carousel < ActiveRecord::Base
validates_presence_of [:alternate_text, :destination_url]
validates_attachment_presence :image
end
<% if params[:action] == "edit"
post_path = admin_carousel_path(:id => @carousel.id)
else
post_path = admin_carousel_index_path
end
%>
<% form_for(@carousel, :url => post_path, :html => {:multipart => true}) do |f| %>
<p>
<%= f.error_messages %>
Given /^a user is logged in as "(.*)"$/ do |email|
visit "/users/sign_up"
fill_in("Business email", :with => email)
fill_in("Password", :with => '123123')
fill_in("Password confirmation", :with => '123123')
fill_in("Name", :with => 'Tester Wester')
fill_in("Home number", :with => '12341234')
fill_in("Business number", :with => '23451234')
fill_in("Mobile number", :with => '55555555')
fill_in("Personal email", :with => 'some@gmail.com')
pma:~ pma$ ssh pma@localhost env
SHELL=/bin/bash
SSH_CLIENT=::1 57377 22
USER=pma
MAIL=/var/mail/pma
PATH=/usr/bin:/bin:/usr/sbin:/sbin
PWD=/Users/pma
SHLVL=1
HOME=/Users/pma
LOGNAME=pma
pma:.ssh pma$ ssh pma@localhost git-receive-pack
/Users/pma/.rvm/scripts/rvm: line 7: syntax error near unexpected token `<'
/Users/pma/.rvm/scripts/rvm: line 7: `grep -q '^rvm ()' < <( declare -f ) # Is RVM is a shell function?'
bash: git-receive-pack: command not found
initializeFormSubmit: function() {
this.formEl.addEvent('submit', function(e) {
e.stop();
fixTiny({instance:'excerpt'});
fixTiny({instance:'body'});
this.formEl.set('send', {
onComplete : this.clearFields()
});
Element.implement('setEvent', function(eventType, func) {
var self = this;
self
.removeEvents(eventType)
.addEvent('click', function(e) {
e.stop();
func.bind(self)()
});
});
pma:chat pma$ mvn jetty:run
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building chat Project
[INFO] task-segment: [jetty:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing jetty:run
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
for i in 39..47
define_method:"size_#{i}_quantity" do
if self.variants.find_by_size(i)
self.variants.count_on_hand
else
0
end
end
end
def size_39_quantity
if self.variants.find_by_size(39)
self.variants.count_on_hand
else
0
end
end
def size_40_quantity
if self.variants.find_by_size(40)