Skip to content

Instantly share code, notes, and snippets.

View jessenaiman's full-sized avatar

Jesse Naiman jessenaiman

View GitHub Profile
@jessenaiman
jessenaiman / songs.js
Created November 13, 2012 01:15
Two arrays that turn out differently in the browser
$(document).ready(function(){
var sample = [
{
title:"Cro Magnon Man",
mp3:"http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3",
oga:"http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg"
},
{
title:"Your Face",
mp3:"http://www.jplayer.org/audio/mp3/TSP-05-Your_face.mp3",
@jessenaiman
jessenaiman / songs.js
Created November 13, 2012 04:09
Mismatched Arrays
$(document).ready(function(){
var sample = [
{
title:"Cro Magnon Man",
mp3:"http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3",
oga:"http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg"
},
{
title:"Your Face",
mp3:"http://www.jplayer.org/audio/mp3/TSP-05-Your_face.mp3",
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
/home/jesse/MusicStore/sandbox/app/models/ckeditor/asset.rb:2:in `<class:Asset>': uninitialized constant Ckeditor::Orm (NameError)
from /home/jesse/MusicStore/sandbox/app/models/ckeditor/asset.rb:1:in `<top (required)>'
from /home/jesse/.rvm/gems/ruby-1.9.3-p327/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
from /home/jesse/.rvm/gems/ruby-1.9.3-p327/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
from /home/jesse/MusicStore/sandbox/app/models/ckeditor/attachment_file.rb:1:in `<top (required)>'
from /home/jesse/.rvm/gems/ruby-1.9.3-p327/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
from /home/jesse/.rvm/gems/ruby-1.9.3-p327/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
from /home/jesse/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in `block in constantize'
from /home/jesse/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `each'
from /home/jesse/.rvm/gems/ruby-1.9.3-p327/gems/activesu
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.0.0-p195/gems/passenger-4.0.5/libout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p195/gems/passenger-4.0.5
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-2.0.0-p195/ruby
PassengerDefaultUser root
<VirtualHost *:80>
ServerName office.dev.liberalonline.ca
ServerAlias office.dev.liberalonline.ca
@jessenaiman
jessenaiman / import_csv_data.rake
Created June 12, 2013 20:43
Saving localized data only saves the french
csv_data.each do |row|
riding = Riding.new
riding.riding_id = row[0]
riding.title = row[1]
riding.save
I18n.locale = :fr
riding.title = row[2]
riding.save
end
class Address
include Mongoid::Document
field :address, type: String
field :address2, type: String
field :city, type: String
field :province, type: String
field :postal_code, type: String
field :phone_number, type: String
field :toll_free_phone_number, type: String
class Riding < ActiveRecord::Base
attr_accessible :poll_stations
#has_many :poll_street_indices
has_many :poll_stations
end
#######################################################
class PollStation < ActiveRecord::Base
attr_accessible :electoral_district, :poll_division, :location, :address1, :address2, :place
@jessenaiman
jessenaiman / gist:6598664
Last active December 23, 2015 07:09
custom devise_invitable controller. Placed in controllers/user/invitation_controller https://github.com/scambra/devise_invitable
class Users::InvitationsController < Devise::InvitationsController
def update
if this
binding.pry
redirect_to root_path
else
binding.pry
super
end
class User
include Mongoid::Document
include Mongoid::Timestamps
include User::AuthDefinitions
include User::Roles