Skip to content

Instantly share code, notes, and snippets.

View jimjeffers's full-sized avatar

Jim Jeffers jimjeffers

View GitHub Profile
@jimjeffers
jimjeffers / newSauce.js
Created July 18, 2011 17:59
Refactored the API for sauce.
// Make a sauce for the headline...
var headlineSauce = new Sauce();
headlineSauce.recipe(function(element){
element.change("y").from(-200).using(Easie.bounceOut);
element.change("scale").from(0).using(Easie.circOut);
});
headlineSauce.duration(1).delay(1).putOn("sauce");
// Make a sauce for the tagline...
var taglineSauce = new Sauce();
@jimjeffers
jimjeffers / fairtax.rb
Created August 16, 2011 17:52
A comparison of the FairTax vs. the Progressive Tax
# FairTax vs. Progressive Income Tax
# DISCLAIMER: This of too simple and doesn't take the rebate/prebates into
# account but illustrates how consumption based taxation can be regressive.
# Current income tax brackets would be the equivalent of 16.9% of income for the middle fifth
# and 23.74% for the upper fifth.
# http://www.moneychimp.com/features/tax_brackets.htm
# Results in $7,361 on $44,943 of earnings.
@jimjeffers
jimjeffers / html5VideoAspectRatioAdjustment.coffee
Created September 15, 2011 13:24
Breaking the HTML5 Video Aspect Ratio
# Just an example.
# @video is a direct reference to a '<video>' element.
# $() is assuming jQuery is being used in this example.
@video.addEventListener("loadedmetadata", (event) =>
actualRatio = @video.videoWidth/@video.videoHeight
targetRatio = $(@video).width()/$(@video).height()
adjustmentRatio = targetRatio/actualRatio
$(@video).css("-webkit-transform","scaleX(#{adjustmentRatio})")
)
@jimjeffers
jimjeffers / a_starting_point
Created November 26, 2011 06:34
Server Bootstrap
# To use this script run:
curl -O https://raw.github.com/gist/1395181/d9147fd2aa0ca24ec609c188438d1eec60f8ffb4/bootstrap.sh; chmod +x bootstrap.sh; sudo ./bootstrap.sh
# Also the script assumes a group with admin privileges
# called admin already exists. If it does not you may want
# to check by running visudo:
#
# Create sudo group:
# (may not be necessary LTS now has admin group by default)
visudo
@jimjeffers
jimjeffers / mixins.scss
Created January 18, 2012 00:16
Some of my most used mix-ins for SASS.
@mixin rounded($side, $radius: 10px) {
border-#{$side}-radius: $radius;
-moz-border-radius-#{$side}: $radius;
-webkit-border-#{$side}-radius: $radius;
}
@mixin round($radius: 10px) {
border-radius: $radius;
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
$.ajax({
url: url
data:
cuepoints: @player.cuepoints
type: "POST"
dataType: "json"
error: (jqXHR, textStatus, errorThrown) =>
@player.errorFlashMessage.html("There was a problem saving the cuepoint data at this time.")
@player.container.addClass(@player.errorClass)
@removeSpinner()
@jimjeffers
jimjeffers / dabblet.css
Created February 17, 2012 23:26
CSS3 Gradient Pixel/Percentage Mix-n-Match Example
/**
* CSS3 Gradient Pixel/Percentage Mix-n-Match Example
*/
background: #f06;
background: linear-gradient(left, #f00 10px, #444 20px, #3465a4 21px, #203388 10rem, #204a87 100%);
min-height:100%;
background: #426fa9;
@jimjeffers
jimjeffers / animator.coffee
Created February 22, 2012 08:45
Animator Gists
class @Animator
@generate: (params={}) ->
animation = "@-#{Animator.prefix()}-keyframes #{params["name"]} {"
for keyframe, rules of params["keyframes"]
animation += "#{keyframe} {"
for property,value of rules
animation += "#{property.replace("prefix",Animator.prefix())}: #{value};"
animation += "}"
animation += "}"
@jimjeffers
jimjeffers / Gemfil
Created February 26, 2012 04:28
Testing Gems
group :development, :test do
gem 'rspec-rails' # Use rspec to do our integration tests.
gem 'factory_girl_rails' # Factory girls makes it easy to mock objects for our tests.
gem 'capybara' # Capybara lets us drive our integration tests via headless browser.
gem 'launchy' # Launchy let's us launch the current state of the app in the browser if we need to diagnose.
gem 'database_cleaner' # Necessary for undoing transactions in the database during our integration tests.
gem 'sqlite3'
gem 'evergreen', :require => 'evergreen/rails'
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
gem 'guard-rspec'
@jimjeffers
jimjeffers / mediaquery.html
Created March 8, 2012 08:21
Allowing media queries to be disabled via CSS class toggle.
<!DOCTYPE html>
<html class="mediaqueries">
<head>
<style type="text/css" media="screen" src="..."></style>
</head>
<body>
...
<a href="#" id="mediaToggle">View the full site.</a>
</body>
</html>