Skip to content

Instantly share code, notes, and snippets.

@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 / firebase.html
Created November 28, 2012 10:46
Hello World Firebase
<html>
<head>
<!--
+1 with firebase. now you just need to write a node app with regression logic
that listens to each new vote on each post and tracks value history to ignore and reset
any malicious db.set(0)'s people run in console when they find this completely
public script on your site. (Firebase is working on their security).
https://www.firebase.com/docs/
https://twitter.com/Stammy/status/272576842345615360
-->
@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 / paulgraham.com.js
Created September 24, 2012 06:52
dotjs file to make pg's essay's a bit more readable
document.getElementsByTagName('font')[0].setAttribute('style', "line-height:1.8; font-size: 16px; color:#444; font-weight:300; font-family: 'Helvetica Neue';");
document.getElementsByTagName('table')[1].style.width = '500px';
@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"