Skip to content

Instantly share code, notes, and snippets.

View sj26's full-sized avatar
🤹‍♂️

Samuel Cochran sj26

🤹‍♂️
View GitHub Profile
@sj26
sj26 / fingerScroll.js
Created February 18, 2012 00:21 — forked from anonymous/fingerScroll.js
plugin for scrolling via finger/dragging
var $.fn.fingerScroll = function () {
this.each(function () {
$(this).on({
mousedown: $.fn.fingerScroll.mouseDown,
mouseup: $.fn.fingerScroll.mouseUp,
});
});
};
$.extend($.fn.fingerScroll, {
@sj26
sj26 / application.js.coffee
Created January 20, 2012 06:49
SPREE SIMPLIFIED CHECKOUT LOGIN
jQuery ($) ->
$form = $("form")
$form.find("radio.action-switcher").change ->
if $(this).prop("checked") and $(this).val() == "register"
$form.attr "action", $form.data("register-action")
else
$form.attr "action", $form.data("login-action")
@sj26
sj26 / macvim.rb
Created January 17, 2012 03:46 — forked from rtgibbons/macvim.rb
Alloy's MacVim (File Browser)
require 'formula'
class Macvim < Formula
homepage 'http://code.google.com/p/macvim/'
version '7.3-61'
head 'https://github.com/alloy/macvim.git', :branch => 'split-browser-lion-merge'
def options
[
# Building custom icons fails for many users, so off by default.
@sj26
sj26 / config.ru
Created January 5, 2012 12:47
Support files for the blog post "Giving Rails 2 The Asset Pipeline"
# we need to protect against multiple includes of the Rails environment (trust me)
require 'config/environment' if !defined?(Rails) || !Rails.initialized?
require 'sprockets'
unless Rails.env.production?
map '/assets' do
run Sprockets::Environment.new Rails.root do |sprockets|
sprockets.logger = Rails.logger
["app", "lib", "vendor"].map { |prefix| Rails.root.join(prefix, "assets") }.select(&:exist?).map { |p| p.children.select(&:directory?) }.flatten.each &sprockets.method(:append_path)
# For a start, a little refactoring doesn't hurt:
def display_friend_discounts(user)
if cart_item.friends.size > 0
safe_join cart_item.friends.map do |friend|
render partial:"#{PPATH}friend_discount_row", object: friend, locals: {savings: PRICE['friend_discount'][user.veteran_status.to_s], cart_item: cart_item}
end
end || ""
end
FactoryGirl.define do
factory :business
factory :client do
business
first "Homer"
end
factory :appointment do
client
@sj26
sj26 / _gem
Created August 31, 2011 04:59 — forked from alexvollmer/_gem
zsh completion for rubygems
#compdef gem gem1.9
gem_general_flags=("(-h --help)"{-h,--help}"[Get help on this command]"
"(-V --verbose)"{-V,--verbose}"[Set the verbose level of output]"
"(-q --quiet)"{-q,--quiet}"[Silence commands]"
"--config-file[Use this config file instead of default]:file:_files"
"--backtrace[Show stack backtrace on errors]"
"--debug[Turn on Ruby debugging]"
$nul_arg
)
def destroy
authorize! :destroy, @health_professional
@health_professional.destroy
respond_with :manage, @health_professional
end