Skip to content

Instantly share code, notes, and snippets.

View tensiondriven's full-sized avatar

Jonathan Yankovich tensiondriven

View GitHub Profile
<h1>Your browser is not supported</h1>
<p>To give our users the best experience, we only allow Chrome, Firefox and Safari.</p>
<p> Please download one of these browsers using the following links:</p>
<ul>
<li> <a href='http://google.com/chrome'>Download Chrome</a> (Preferred)
<li> <a href='http://www.apple.com/safari/'>Download Safari</a>
<li> <a href='http://www.mozilla.org/en-US/firefox/new/'>Download Firefox</a>
</ul>
def self.create_for_referral_viewed(referral)
first_or_create({
user: referral.opportunity.owner,
name: 'view',
actable: referral,
actor: referral.redeemed_by # may be nil, can't count on it being there
})
end
# Hey Jose - should first_or_create take some criteria? What criteria is this using?
%td
= form_for task, :remote => true, :url => ajax_update_path do |f|
= f.collection_select :task_type_id, TaskType.all, :id, :name, {}, { :class => 'submittable'}
%td
= form_for task, :remote => true, :url => 'ajax_update' do |f|
f.collection_select :task_type_id, TaskType.all, :id, :name, {}, { :class => 'submittable'}
end
%h1 Listing tasks
%table
%tr
%th Name
%th Type
%th Active
%th{:style=>"width: 300px"}
- @tasks.each do |task|
%tr
%td
@tensiondriven
tensiondriven / gist:1528698
Created December 28, 2011 17:05
Get list of all zones where it is midnight
zones_where_it_is_midnight = []
ActiveSupport::TimeZone.zones_map.each{ |zone|
if (Time.now.in_time_zone(zone[1]).strftime('%k').to_i == 0)
zones_where_it_is_midnight << zone[0]
end
}
puts zones_where_it_is_midnight.inspect
2012-05-24 20:52:44.579 Last5[26748:15b03] ----------[>] LoginController init
2012-05-24 20:52:44.592 Last5[26748:15b03] -----[>] LoginController viewDidLoad
2012-05-24 20:52:52.571 Last5[26748:15b03] startAsynchronousRequest started: https://secure.last5.co/tasks.json
2012-05-24 20:52:53.886 Last5[26748:15b03] startAsynchronousRequest complete [200]: [{"task":{"active":true,"color_id":null,"created_at":"2011-09-22T20:21:15Z","external_id":null,"id":23,"integration_id":null,"metadata":null,"name":"Break","position":1,"project_id":null,"task_type_id":null,"updated_at":"2012-05-17T16:34:25Z","user_id":1,"last_entry_timestamp":null}},{"task":{"active":true,"color_id":null,"created_at":"2011-09-22T02:25:09Z","external_id":null,"id":19,"integration_id":null,"metadata":null,"name":"Last5","position":2,"project_id":null,"task_type_id":3,"updated_at":"2012-05-17T16:34:25Z","user_id":1,"last_entry_timestamp":null}},{"task":{"active":true,"color_id":null,"created_at":"2011-09-23T03:20:28Z","external_id":null,"id":25,"i
@tensiondriven
tensiondriven / gist:2933858
Created June 15, 2012 00:30
Email id token encode/decode method
def self.get_guid record_id
str = record_id.to_s(36)
hash = (Digest::SHA1.hexdigest "SALTY#{record_id}HASH")[0..3].downcase
"[#{hash}#{str}]"
end
def self.get_id_for_guid guid
old_hash = guid[0..3]
record_id = guid[4..-1].to_i(36)
hash = (Digest::SHA1.hexdigest "SALTY#{record_id}HASH")[0..3].downcase
@tensiondriven
tensiondriven / gist:2945452
Created June 17, 2012 18:56
Objectiveli simple frame rules
def frametest
Log.log ''
Log.log ''
Log.log ''
Log.log ''
Log.log 'xx start'
frames, counts = get_flat_goals_array
@width = 640
@height = 480
Loading production environment (Rails 3.2.3)
irb(main):001:0> u = User.new
=> #<User id: nil, email: "", encrypted_password: "", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, authentication_token: nil, created_at: nil, updated_at: nil, short_name: nil, invited_by_id: nil, name: nil, group_id: nil, first_time_email: true, first_time_web: true, first_time_password: nil, terms: nil, pref_send_me_email_updates: true, pref_send_me_my_email_updates: false>
irb(main):002:0> u.terms
=> nil
i