Skip to content

Instantly share code, notes, and snippets.

View traviskroberts's full-sized avatar

Travis Roberts traviskroberts

View GitHub Profile
<%= form_tag form_submit_path do %>
<fieldset>
<legend>Contact Info</legend>
<div class="form-group">
<%= label_tag :name %>
<%= text_field_tag :name %>
</div>
<div class="form-group">
class ApplicationController < ActionController::Base
before_filter :set_rand_cookie
private
def set_rand_cookie
return if cookies[:rand_seed].present?
cookies[:rand_seed] = {value: rand(100), expires: Time.now + 900}
end
end
@traviskroberts
traviskroberts / 1_activeadmin_user.rb
Created February 5, 2014 16:47
Custom filter for ActiveAdmin.
ActiveAdmin.register User do
index do
column :id
column :full_name, sortable: :last_name
column :status
default_actions
end
filter :first_name
gulp = require 'gulp'
gutil = require 'gulp-util'
# contrib modules
streamee = require 'streamee'
concat = require 'gulp-concat'
coffee = require 'gulp-coffee'
uglify = require 'gulp-uglify'
sass = require 'gulp-sass'
@traviskroberts
traviskroberts / _instructions.md
Last active April 17, 2018 17:33
Simple rake task to deploy staging and production apps to Heroku. Based on: https://gist.github.com/njvitto/362873

Deploying Via Rake Task

  • Edit the PRODUCTION_APP and STAGING_APP variables at the top of the file.
  • Set the heroku remotes by running rake:set_remotes
  • Once you're ready to deploy, you can run rake deploy:production or rake deploy:staging
@traviskroberts
traviskroberts / .htaccess
Created November 9, 2013 20:10
Basic maintenance page.
# Don't forget to turn on the rewrite engine
RewriteEngine on
# Maintenance Redirection (lets images and styles through)
RewriteCond %{REQUEST_URI} !maintenance.html
RewriteCond %{REQUEST_FILENAME} !(styles|images).+$
RewriteRule (.*) /maintenance.html [R,L]
#!/bin/sh
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
TARGET=$1
: ${TARGET:="master"}
echo "\033[33m=> git checkout ${TARGET}\033[0m"
git checkout ${TARGET}
echo "\033[33m=> git pull origin ${TARGET}\033[0m"
gem 'taps'
gem 'sqlite3' # dependency of taps
// FIXES FOR WYSIWYG EDITOR
li.tinymce {
overflow: auto;
> div {
float: left;
width: 76%;
}
}
describe 'it should regenerate the guid if one already exists' do
FactoryGirl.create(:user, guid: '123456')
SecureRandom.stub(:hex).and_return('123456', '456789')
user = User.new(email: 'john@email.com', total_budget: 250.00)
user.save
expect(user.reload.guid).to eq(6)
end