Skip to content

Instantly share code, notes, and snippets.

View benschwarz's full-sized avatar
🏁
Making the web fast

Ben Schwarz benschwarz

🏁
Making the web fast
View GitHub Profile
@benschwarz
benschwarz / main.css
Created February 25, 2013 09:50
SVG background image with PNG fallback
.module {
background: url('logo.png');
background: none, url('logo.svg');
}
@benschwarz
benschwarz / deploy
Last active December 11, 2015 23:49
Deploying a static site to S3
#!/usr/bin/env bash
assets='stylesheets javascripts images fonts'
echo "Deploying: $assets"
s3cmd sync --force --reduced-redundancy --acl-public $assets s3://a.germanforblack.com/
@benschwarz
benschwarz / gist:4669360
Created January 30, 2013 00:15
Convert a github issue into a pull request
hub pull-request -i <issue-id-number> -h <gh-account>:<branch-name>
@benschwarz
benschwarz / sync-localStorage.coffee
Last active December 10, 2015 20:48
Drop this into a Backbone.Collection to store retrieved JSON in localStorage. The stored content will be used when the user is offLine.
sync: ( method, collection, options ) ->
content = localStorage.getItem( @url() ) if localStorage
if content and not navigator.onLine
options.success JSON.parse content
else
return Backbone.sync( method, collection, options ).done ( response ) =>
localStorage.setItem( @url(), JSON.stringify( response ) ) if localStorage
@benschwarz
benschwarz / tap-highlight-event.js
Created December 28, 2012 23:52
Mobile tap highlighting. Don't use `:hover`, don't use `:active`
$('a').on('touchstart', function(event) {
return $(this).addClass('tapped');
});
$('a').on('touchend', function() {
return $(this).removeClass('tapped');
});
@benschwarz
benschwarz / Readme.md
Created November 12, 2012 11:59
Use postmarkapp.com and YQL to deliver email

Howto:

  • Run an insert statement to YQL, storing your API Key with a use statement linking to this gist.
insert into yql.storage.admin (value) values ("
use 'https://raw.github.com/gist/5ceb77a28686513f16a7/cb17fcb095847f320426fb0fc5261d47cf62b0d8/postmark.xml' as postmark;
set api_key='YOUR KEY HERE' on postmark;
")
@benschwarz
benschwarz / instagram.xml
Created November 7, 2012 14:24
A YQL table for instagram.user.media.recent
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd" https="true">
<meta>
<author>Ben Schwarz</author>
<description>Get the recent images for a given user on instagram</description>
<documentationURL>http://instagram.com/developer/endpoints/users/#get_users_media_recent</documentationURL>
<apiKeyURL></apiKeyURL>
</meta>
<bindings>
<select itemPath="" produces="JSON">
@benschwarz
benschwarz / index.html
Created October 25, 2012 00:44
A CodePen by Ben Schwarz.
<h1>An auto playing image gallery with controls</h1>
<p>Sans-javascript, kids</p>
<div class="fading-gallery fading-gallery-size-3">
<div id="image-1" class="control-operator"></div>
<img src="http://placehold.it/200x300.png&text=one">
<div id="image-2" class="control-operator"></div>
<img src="http://placehold.it/200x300.png&text=two">
<div id="image-3" class="control-operator"></div>
@benschwarz
benschwarz / index.html
Created October 25, 2012 00:44
A CodePen by Ben Schwarz.
<h1>An auto playing image gallery with controls</h1>
<p>Sans-javascript, kids</p>
<div class="fading-gallery fading-gallery-size-3">
<div id="image-1" class="control-operator"></div>
<img src="http://placehold.it/200x300.png&text=one">
<div id="image-2" class="control-operator"></div>
<img src="http://placehold.it/200x300.png&text=two">
<div id="image-3" class="control-operator"></div>
@benschwarz
benschwarz / index.html
Created October 24, 2012 13:22
A CodePen by Ben Schwarz.
<h1>An auto playing image gallery with controls</h1>
<div class="fading-gallery fading-gallery-size-3">
<div id="image-1" class="control-operator"></div>
<img src="http://placehold.it/200x300.png&text=one">
<div id="image-2" class="control-operator"></div>
<img src="http://placehold.it/200x300.png&text=two">
<div id="image-3" class="control-operator"></div>