Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Hartley alexhartley

View GitHub Profile
View gist:42541a49e6d583f42a2f39866825c935
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
View keybase.md

Keybase proof

I hereby claim:

  • I am alexhartley on github.
  • I am alexhartley (https://keybase.io/alexhartley) on keybase.
  • I have a public key whose fingerprint is D3D6 5330 9D63 8220 E101 75BD 2131 3ADA 2822 7712

To claim this, I am signing this object:

View refactor.rb
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 Oct 18, 2012 — forked from kylewelsby/risk.rb
Example for NWRUG visitor
View risk.rb
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 / gemfile
Created Oct 6, 2012
Gem file for spree store
View gemfile
source 'http://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.7'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
@alexhartley
alexhartley / Fullpage.html
Created Jun 19, 2012
Matt Hamm's Page Curl Boxes
View Fullpage.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Matt Hamm's Page Curl Boxes &middot; CodePen</title>
<link rel="stylesheet" href="http://codepen.io/stylesheets/css/reset.css">
View Fullpage.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Mobile First Grids &middot; CodePen</title>
<link rel="stylesheet" href="http://codepen.io/stylesheets/css/normalize.css">
@alexhartley
alexhartley / Fullpage.html
Created Jun 19, 2012
A web page created at CodePen.io
View Fullpage.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Mobile First Grids &middot; CodePen</title>
<link rel="stylesheet" href="http://codepen.io/stylesheets/css/normalize.css">
@alexhartley
alexhartley / gist:2507426
Created Apr 27, 2012 — forked from dhh/gist:1975644
Rails Mass Assignment Protection
View gist:2507426
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
View form_mail.php
// Define some constants
define( "RECIPIENT_NAME", "John Smith" );
define( "RECIPIENT_EMAIL", "john@example.com" );
define( "EMAIL_SUBJECT", "Visitor Message" );
// Read the form values
$success = false;
$senderName = isset( $_POST['senderName'] ) ? preg_replace( "/[^\.\-\' a-zA-Z0-9]/", "", $_POST['senderName'] ) : "";
$senderEmail = isset( $_POST['senderEmail'] ) ? preg_replace( "/[^\.\-\_\@a-zA-Z0-9]/", "", $_POST['senderEmail'] ) : "";
$message = isset( $_POST['message'] ) ? preg_replace( "/(From:|To:|BCC:|CC:|Subject:|Content-Type:)/", "", $_POST['message'] ) : "";