Skip to content

Instantly share code, notes, and snippets.

View jimjeffers's full-sized avatar

Jim Jeffers jimjeffers

View GitHub Profile
@jimjeffers
jimjeffers / check_for_touch.coffee
Created April 30, 2012 16:10
specific_snippets
if Modernizr.touch and @article? and @touchTarget?
@jimjeffers
jimjeffers / article_constructor.coffee
Created April 29, 2012 02:17
Touch Based Article Navigation Snippets 2
constructor: (params={}) ->
# Store the href for reference. We'll need it for history.pushState.
@href = params["href"]
# Create a temp element to store and parse the response content.
tempElement = document.createElement("div")
tempElement.innerHTML = params['html']
# Grab and assign the article.
if params['element']?
@jimjeffers
jimjeffers / article_touch_end.coffee
Created April 28, 2012 08:12
Touch Based Article Navigation Snippets
touchEnd: (event) ->
limit = window.innerWidth/3
if @slideTo > 0 and Math.abs(@slideTo) >= limit
@moveTo(window.innerWidth)
else if @slideTo < 0 and Math.abs(@slideTo) >= limit
@moveTo(-window.innerWidth)
else
@moveTo(0)
@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>
@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 / 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 / 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;
$.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 / 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;
@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