Skip to content

Instantly share code, notes, and snippets.

View dinjas's full-sized avatar
:shipit:
Alive

Jason Dinsmore dinjas

:shipit:
Alive
  • Battle Ground, WA
View GitHub Profile
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
#!/usr/bin/env ruby
PRESUMPTIVE_RAILS_ROOT = "/data/[APP_NAME]/current"
LOG_PATH = "/data/[APP_NAME]/shared/log/delayed_job_singleton.log"
Dir.chdir PRESUMPTIVE_RAILS_ROOT
require 'home_run'
require "rubygems"
require "bundler/setup"
@dinjas
dinjas / hack.sh
Created March 31, 2012 22:43 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@dinjas
dinjas / avatar_uploader.rb
Created February 2, 2012 21:56 — forked from kirs/avatar_uploader.rb
Validation of image dimensions with CarrierWave
# encoding: utf-8
class AvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# Override the directory where uploaded files will be stored.
@dinjas
dinjas / en.yml
Created January 27, 2012 02:18 — forked from chrisbloom7/01-validates-file-size-carrierwave.md
A cheap knock off of the default validates_length_of validator, but checks the filesize of a Carrierwave attachment
# config/locales/en.yml
en:
errors:
messages:
wrong_size: "is the wrong size (should be %{file_size})"
size_too_small: "is too small (should be at least %{file_size})"
size_too_big: "is too big (should be at most %{file_size})"
@dinjas
dinjas / Fancy File Inputs.js
Created January 13, 2012 06:24 — forked from davist11/Fancy File Inputs.js
Fancy File Inputs
var SITE = SITE || {};
SITE.fileInputs = function() {
var $this = $(this),
$val = $this.val(),
valArray = $val.split('\\'),
newVal = valArray[valArray.length-1],
$button = $this.siblings('.button'),
$fakeFile = $this.siblings('.file-holder');
if(newVal !== '') {
#!/bin/sh
RSYNC_DEFAULT_OPTIONS="-r -t -v -L --delete --stats --progress"
RSYNC_TEMP_DIR="./tmp_rsync_dir/"
# Sources
ITUNES_PODCASTS_DIR="/Users/adam/Music/iTunes/iTunes Music/Podcasts/"
ITUNES_MUSIC_DIR="/Users/adam/Music/iTunes/iTunes Music/"
ALBUMS=(
"Bone Thugs-N-Harmony/Strength & Loyalty"