Skip to content

Instantly share code, notes, and snippets.

class AdminController < ApplicationController
rescue_from Acl9::AccessDenied, with: :unauthorized_redirect
before_filter :require_user
access_control do
allow :admin
end
def show
<p><%=t :company_name %></p>
user_ids = [33059,48036,102589,7855,28242,34357,32814,105563,49276,13742,55687,52362,101326,104011,59650,47441,34356,9943,15500,45671,50681,48829,50681,57270,6514,6871,101326,33059,7855,48036,6514,6514,47441,102589,10755,34357,28242,34357,34357,26495,87999,24526,110477,41230,29370,31488,62817,107890,91591,27546,58165,101840,102836,59052,30103,10491,22178,6007,18346,32969,28227,50915,60469,10532,91591,101326,62817,58066,16894,58165,102589,91591,46802,91591,31488,31488,57080,57080,91591,58165,31488,52913,52913,29882,55808]
user_ids.each do |user_id|
user = User.find_by_id(user_id)
user.delay.recalculate_completions! unless user.nil?
end
module.exports = {
instructions: "Here are the instructions",
success:function(expression) {
expression.hasString();
}
}
@camwest
camwest / gist:1633115
Created January 18, 2012 13:58
Stop stop sopa bookmarklet for Wikipedia.
javascript:(function(){document.getElementById("content").style.cssText = "display:block";document.getElementById("mw-sopaOverlay").style.cssText = "display:none";})();
require 'csv'
def transform_merge(csv_file)
CSV.open(@csv_file).read.each do |line|
end
end
def multiple_merge(inputs)
errors = []
def merge(user1, user2, preferred_email)
raise "Email cannot be the same" if (user1 == user2)
u = User.unscoped.find_by_email(user1)
u2 = User.unscoped.find_by_email(user2)
raise "User1 not found" if u.nil?
raise "User2 not found" if u2.nil?
if u.alternate_ids.empty?
@camwest
camwest / gist:1313629
Created October 25, 2011 17:47
Who's behind sample script
log = Logger.new("/tmp/whos_behind.log")
log.info "Producer Number, Full Name, Email, Party Key, Agency Status, Personal Status, Completed Elective Points, Outstanding Essentials"
Certification.where(["code IN(?)", [:agent, :lsp]]).each do |certification|
certification.users.limit(10).each do |user|
if user.party_type == 'Agent'
organization = user.organization
agency_status = organization.status
module Owner
class Response
def each
10.times do |i|
yield("entry #{i}\n")
sleep 1
end
end
end
@camwest
camwest / Stately ViewState support for Backbone.js Views
Created October 23, 2010 21:58
A simple implementation of view states for Backbone.js
// (c) 2010 Cameron Westland, Big Bang Technology Inc.
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://bigbangtechnology.github.com/stately
/**
Example:
var MyView = Backbone.View.extend(Stately).extend({
states: {
EDITING: "editing",