Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View alexhartley's full-sized avatar

Alex Hartley alexhartley

View GitHub Profile
Modified from the gist @https://gist.github.com/odiumediae/3b22d09b62e9acb7788baf6fdbb77cf8
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
sudo apt-get install checkinstall
sudo rm -rf /usr/local/share/vim /usr/bin/vim
class DCode
def initialize(assessment, user)
@assessment = assessment
@user = user
end
def code
"#{site.name[0,2]}-#{department_code}".upcase
end
@alexhartley
alexhartley / risk.rb
Created October 18, 2012 18:51 — forked from kylewelsby/risk.rb
Example for NWRUG visitor
require 'rspec'
class Risk
def code(user)
user_site = user.site[0..1]
if department
department_name = department.name[0..1]
end
[user_site,department_name,"001"].compact.join('-').upcase
@alexhartley
alexhartley / gist:2507426
Created April 27, 2012 08:28 — forked from dhh/gist:1975644
Rails Mass Assignment Protection
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private