Skip to content

Instantly share code, notes, and snippets.

@stammy
stammy / Rakefile
Created January 24, 2011 08:01
rake task for creating a new jekyll post.
# ignore the "bit" stuff.. only relevant to my custom jekyll fork
desc 'create new post or bit. args: type (post, bit), title, future (# of days)'
# rake new type=(bit|post) future=0 title="New post title goes here" slug="slug-override-title"
task :new do
require 'rubygems'
require 'chronic'
type = ENV["type"] || "bit"
title = ENV["title"] || "New Title"
{
"color_scheme": "Packages/Color Scheme - Default/Blackboard.tmTheme",
"file_exclude_patterns":
[
"_site/*"
],
"font_face": "monaco",
"font_size": 10.5
}
@stammy
stammy / nginx.conf
Created December 29, 2012 11:41 — forked from phpdude/nginx.conf
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@stammy
stammy / gist:4166118
Created November 29, 2012 01:26
IAM S3 read-only
// AWS IAM S3 Read-only, single bucket policy
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketAcl",
"s3:GetBucketLocation",
"s3:GetBucketNotification",
@stammy
stammy / high-dpi-media.scss
Created November 26, 2012 06:27 — forked from kimroen/high-dpi-media.scss
A Sass media query mixin that captures almost all high DPI aware devices.
/* ----------------------------------------------------------------------- */
/* */
/* Improved upon a mixin from 37signals and combined */
/* with these numbers from marc. */
/* */
/* 37signals-version: */
/* http://37signals.com/svn/posts/3271-easy-retina-ready-images-using-scss */
/* */
/* @kimroen */
/* */
@stammy
stammy / _media-queries.scss
Created November 26, 2012 06:16 — forked from anthonyshort/_media-queries.scss
Media Queries in Sass
// Media Queries in Sass 3.2
//
// These mixins make media queries a breeze with Sass.
// The media queries from mobile up until desktop all
// trigger at different points along the way
//
// And important point to remember is that and width
// over the portrait width is considered to be part of the
// landscape width. This allows us to capture widths of devices
// that might not fit the dimensions exactly. This means the break
@stammy
stammy / 5by5.html
Created November 9, 2012 23:31
Front-end Challenge: 5x5 grid of blocks that change color when ... (click download and run this in your browser)
<!--
Create a 5 x 5 grid of blue blocks. When a block is clicked it turns red. Its adjacent block turns green.
If a red block is on the end of a row, the adjacent green block is on the line below on the first column,
et cetera. When another block is clicked, the previous red/green blocks go back to blue. There will only
ever be one red and one green block on the screen, the rest are always blue.
Only worry about Chrome.
------
@stammy
stammy / promises.md
Created October 22, 2012 06:08 — forked from domenic/promises.md
You're Missing the Point of Promises

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
    // the rest of your code goes here.
});
@stammy
stammy / gist:2915921
Created June 12, 2012 07:38
css3 image mask
I had a background image that I wanted to apply border-radius to-- which you can't do to a background image. masks to the rescue! I opted for a method that didn't require an image mask overlay.
radial gradient params: (x/y positioning, width/height, how sharp you want the edges to be, dont mess with last value)
-webkit-mask-box-image: -webkit-radial-gradient(19px 19px, 19px 19px, black 92%, transparent 100%)
@stammy
stammy / underscoreR.coffee
Created May 7, 2012 03:06 — forked from jimtla/underscoreR.coffee
Add CoffeeScript friendly argument order to Underscore.js
# Five lines of code that will make your underscore + CoffeeScript use cleaner.
# Creates an underscore function for each function in to_reverse with R (short for Reversed) appended to the name.
# The R version moves the function argument (first argument in normal underscore) to the end,
# so you can write:
$(window).scroll _.throttleR 500, ->
console.log "This print's at most every 500ms"
# Instead of:
$(window).scroll _.throttle ->
console.log "This prints at most every 500ms too"