Skip to content

Instantly share code, notes, and snippets.

View chrismear's full-sized avatar
😸

Chris Tucker Mear chrismear

😸
View GitHub Profile
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
irb(main):004:0> t1 = Time.now
=> Fri May 08 11:14:09 +0100 2009
irb(main):005:0> t2 = Time.utc(2009, 5, 9)
=> Sat May 09 00:00:00 UTC 2009
irb(main):006:0> difference = t2 - t1
=> 49550.731764
irb(main):007:0> t1 + difference
=> Sat May 09 01:00:00 +0100 2009
irb(main):001:0> a = 10.12
=> 10.12
irb(main):002:0> b = (a*100)
=> 1012.0
irb(main):003:0> sprintf("%.16f", b)
=> "1011.9999999999998863"
irb(main):004:0> b.to_i
=> 1011
irb(main):005:0> b.round
=> 1012
# Use in conjunction with the tab helper to create a list of tabs
#
# For example:
#
# <% tab_list do -%>
# <%= tab "Photos", campaign_photos_path(:campaign_id => @campaign), "campaign_photos", :selected %>
# <%= tab "Videos", campaign_videos_path(:campaign_id => @campaign), "campaign_videos" %>
# <%= tab "Information", campaign_information_path(:campaign_id => @campaign), "campaign_information" %>
# <% end -%>
def tab_list(id=nil, &block)
before :each do
10.times do |i|
Factory.create(:action)
end
end
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="Authorization,Accept,Content-Type"/>
</cross-domain-policy>
Array.prototype.indexOf = function(objectToFind) {
var i;
var l = this.length;
for (i = 0; i < l; i++) {
if (this[i] === objectTofind) {
return i;
}
}
return -1;
}
New clause row, 'organisation_state' (?) which can be empty, 'pending' or 'active'. Empty is the initial state, while organisation details are being entered; 'pending' is once all details have been entered and we are waiting for the founding meeting; 'active' is once the founding meeting has been confirmed.
Somewhere to store the founding meeting's date, time and location
Draft template for founding meeting agenda
'Induction' controller:
Action for setting the founder's user details
Actions for setting the organisation/constitution settings
Action for setting the founding meeting details (which moves the organisation from empty to 'pending' state)
module ActiveRecord
module Base
def self.valid_attributes?(test_attributes)
self.new(test_attributes).valid?
end
end
end
class Test
def test
hash = {:entry => ""}
array = []
array << self.test2(hash.dup)
array << self.test2(hash.dup)
array << self.test2(hash.dup)
array << self.test2(hash.dup)
array << self.test2(hash.dup)
array