Skip to content

Instantly share code, notes, and snippets.

// Prime function
$('.iswitch label input:checked').each(function(){
$(this).parents("label").addClass("on");
})
$(".iswitch label span input:[type=checkbox][checked=false]").each(function(){
$(this).parents("label").addClass("off");
})
= form_for(:user, :as => :user, :url => session_path(:user)) do |f|
- begin
= devise_error_messages!
- rescue => e
- nil
%label{:for => @login_param.to_s} Email
= f.text_field :email, :class => "email"
%label{:for => @password_param.to_s} Password
= f.password_field :password, :class => "password"
@notch8-old
notch8-old / gist:1407060
Created November 29, 2011 23:07
itermColor.applescript
-- This nasty constant might as well be a global
global kColorValueMaximum
set kColorValueMaximum to 32767
-- Using only half the max of 65535
-- Choose a random color for the background
set randomRed to (random number) * kColorValueMaximum
set randomGreen to (random number) * kColorValueMaximum
set randomBlue to (random number) * kColorValueMaximum
set myBackgroundColor to {randomRed, randomGreen, randomBlue}
@notch8-old
notch8-old / gist:1401774
Created November 28, 2011 19:57
Facebook add app to page
# Get the pages access token
accounts = MiniFB.get(u.facebook_access_token, facebook_user["id"], :type => "accounts")
account = accounts.data.first
# Add the app to to the page using the access token
MiniFB.post(account.access_token, "#{account.id}/tabs", :app_id => "189977524185")
@notch8-old
notch8-old / gist:1321026
Created October 27, 2011 22:05
Gangaroo Gems
Gems included by the bundle:
* actionmailer (3.1.0)
* actionpack (3.1.0)
* activemodel (3.1.0)
* activerecord (3.1.0)
* activeresource (3.1.0)
* activesupport (3.1.0)
* acts_as_list (0.1.4)
* addressable (2.2.6)
* ancestry (1.2.0 a95aa4b)
@notch8-old
notch8-old / gist:1321015
Created October 27, 2011 22:01
Gems in Gangaroo
Gems included by the bundle:
* actionmailer (3.1.1)
* actionpack (3.1.1)
* activemodel (3.1.1)
* activerecord (3.1.1)
* activeresource (3.1.1)
* activesupport (3.1.1)
* addressable (2.2.6)
* archive-tar-minitar (0.5.2)
* arel (2.2.1)
263 def create_links
264 old_links = self.links.clone
265 new_links = self.content.scan(LINK_REGEXP)
266 new_links.each do |link_result|
267 if current_link = create_or_update_link link_result.first
268 old_links.delete(current_link)
269 end
270 end
271
272 old_links.each do |old_link|
unless File.exists?("PATH_TO_MOUNT/mounted")
`umount PATH_TO_MOUNT`
`mount -a`
end
@notch8-old
notch8-old / campaign.rb
Created August 27, 2011 00:31 — forked from etdebruin/campaign.rb
Campaign
class Campaign < ActiveRecord::Base
belongs_to :user
#scope :active, where(:active => true)
#scope :not_yet_active, where(:active => false)
validates :goal, :presence => true
validates :url, :presence => true
validates :name_or_twitter, :presence => true
attr_accessor :complete_tweet
# Returns the data recieved in the request body.
#
# This method support both application/x-www-form-urlencoded and
# multipart/form-data.
def POST
if @env["rack.input"].nil?
raise "Missing rack.input"
elsif @env["rack.request.form_input"].eql? @env["rack.input"]
@env["rack.request.form_hash"]
elsif form_data? || parseable_data?