Skip to content

Instantly share code, notes, and snippets.

View cameroncox's full-sized avatar

Cameron Cox cameroncox

View GitHub Profile
@cameroncox
cameroncox / desktop.ps1
Last active March 11, 2019 11:57 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# app/models/activity.rb
class Activity < ActiveRecord::Base
serialize :details
end
# app/controllers/deploys_controller.rb
def create
class ReportMailer < ActionMailer::Base
default from: "admin@hillcrestanimalhospital.co.uk"
def income_by_month_report(report_results)
@report_results = report_results
mail(to: "danny@hillcrestanimalhospital.co.uk", subject: "Monthly Income Report")
end
end
@cameroncox
cameroncox / descriptive_sql_load_log.rb
Created July 19, 2011 20:48 — forked from JackDanger/descriptive_sql_load_log.rb
Let Rails display file names and line numbers for log activity.
module ActiveRecord
module ConnectionAdapters
class AbstractAdapter
protected
# Turn:
# User Load (6.3ms) SELECT * FROM "users"
# Into:
# User Load /app/views/_partial.erb:27 (6.3ms) in `_app_views_partial_erb` SELECT * FROM "users"
module Authorization
module User
# include ::DataMapper::Resource
# This is a "vanity" relationship. A user may not have all permissions for an entire role,
# but still may be said to be a member of the role.
# has_and_belongs_to_many :roles
has 1.0/0, :roles, :through => ::DataMapper::Resource
# This relationship contains the actual list of permissions the user has been granted.
has 1.0/0, :permissions, :through => ::DataMapper::Resource