Skip to content

Instantly share code, notes, and snippets.

View rossnelson's full-sized avatar
💀

Ross Nelson rossnelson

💀
View GitHub Profile
@rossnelson
rossnelson / 0_reuse_code.js
Created July 2, 2014 15:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rossnelson
rossnelson / sitemap.rb
Last active August 29, 2015 14:04
How would you make this better?
module Dust
class Sitemap
def self.items
menus.includes(:menu_items).map { |menu| menu.menu_items }.flatten
end
def self.names
Dust.config.menus_on_sitemap.join("|")
end

Keybase proof

I hereby claim:

  • I am rossnelson on github.
  • I am rossnelson (https://keybase.io/rossnelson) on keybase.
  • I have a public key whose fingerprint is 097E C2EB A696 EEA0 F1C4 6C15 F2EC 5605 B7EE A4E4

To claim this, I am signing this object:

@rossnelson
rossnelson / facebook.php
Last active August 29, 2015 14:10 — forked from jonathantneal/facebook.php
Social Media Access
<?php
/* Getting a JSON Facebook Feed
==========================================================================
1. Sign in as a developer at https://developers.facebook.com/
2. Click "Create New App" at https://developers.facebook.com/apps
3. Under Apps Settings, find the App ID and App Secret
# Probably excessive, but it makes these instructions simpler
sudo -i
# Add postgresql repo and update apt listing
echo "deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main" > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-get update
# For some reason this is necessary with PostgreSQL on Ubuntu 12.04
update-alternatives --remove postmaster.1.gz /usr/share/postgresql/9.1/man/man1/postmaster.1.gz
@rossnelson
rossnelson / .bash_profile.sh
Last active December 11, 2015 18:51
How my dotfiles are setup
# Just includes the others
source $HOME/.profile
source $HOME/.bashrc
@rossnelson
rossnelson / index.haml
Created February 8, 2016 15:45
Rails 3-4 simple search
= form_tag path_to_results_path, method: :post do
%p
= text_field_tag :search, params[:search]
= submit_tag "Search", name: nil
@rossnelson
rossnelson / coupon_validator.rb
Last active March 22, 2016 13:14
Coupon Validator
class Store::CouponValidator < SimpleDelegator
include ActiveModel::Validations
include QueryUtils
include Store::ValidationUser
include Store::ValidationCoupon
attr_accessor :user_id, :coupon_code
def initialize(options)
@user_id = options[:user_id]
{
"title": "BASS Medical Group - Walnut Creek",
"fields": [
{
"type": "short_text",
"question": "What is your first and last name?",
"description": "Only management will see your name for the purpose of follow up, if needed. If you'd prefer to leave anonymous feedback, you can skip this question.",
"required": false
},
{
@rossnelson
rossnelson / totals.txt
Created August 24, 2016 20:40
CardCode 888313
91
returns = 86.11
orders = 2127.92
2007
returns = 0
orders = 4559.54