Skip to content

Instantly share code, notes, and snippets.

View bcherny's full-sized avatar

Boris Cherny bcherny

View GitHub Profile
@bcherny
bcherny / gist:6096484
Created July 27, 2013 22:09
Start SASS and CoffeeScript
cd ${0%/*} # cd to directory this script is in
clear # clear the console
echo "Starting SASS and Coffee..."
# start SASS
sass --watch sass:css &
# start CoffeeScript
coffee --watch --compile --output js/ coffee/
@bcherny
bcherny / CoffeeUMD.coffee
Created September 15, 2013 00:55
CoffeeScript UMD
umd = (factory) ->
if typeof exports is 'object'
module.exports = factory()
else if typeof define is 'function' and define.amd
define([], factory)
else
@MODULE_NAME = factory()
umd
@bcherny
bcherny / transform-to-matrix.css
Created September 17, 2013 04:23
CSS transform functions and their matrix equivalents
/* translate */
> translate (x, y)
matrix(
1, 0, 0,
1, x, y
)
> translate3d (x, y, z)
matrix3d(
@bcherny
bcherny / Gruntfile.coffee
Created October 15, 2013 05:18
Gruntfile for compiling and minifying dependency-free coffeescripts. Names the file after its current directory.
module.exports = (grunt) ->
nameParts = __dirname.split '/'
name = nameParts[nameParts.length - 1]
config =
pkg: 'package.json'
coffee:
@bcherny
bcherny / apple-touch-icon declaration
Created October 16, 2013 07:18
iOS `apple-touch-icon` HTML `<link>`s
<!-- non-retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="icon57.png" sizes="57x57">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="icon72.png" sizes="72x72">
<!-- non-retina iPad iOS 7 -->
<link rel="apple-touch-icon" href="icon76.png" sizes="76x76">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="icon114.png" sizes="114x114">
<!-- retina iPhone iOS 7 -->
<link rel="apple-touch-icon" href="icon120.png" sizes="120x120">
@bcherny
bcherny / Gruntfile-UMD.coffee
Last active December 25, 2015 20:29
Gruntfile for compiling, wrapping with UMD, and minifying dependency-free coffeescripts. Names the file after its current directory, and loads dependencies from `package.json`.
module.exports = (grunt) ->
nameParts = __dirname.split '/'
name = nameParts[nameParts.length - 1]
pkg = grunt.file.readJSON 'package.json'
deps = grunt.util._.keys pkg.dependencies
config =
pkg: pkg
@bcherny
bcherny / contributor.io-sample.coffee
Last active December 28, 2015 22:29
Sample CURL API request for contributor.io.
getCounts = (identities, callback) ->
encoded = ''
# encode identities
for key, identity of identities
encoded += "#{if encoded then '&' else ''}#{key}=#{identity}"
xhr = new XMLHttpRequest
url = "http://www.contributor.io/api?#{encoded}"
@bcherny
bcherny / contributor.io-sample.bash
Last active December 28, 2015 22:29
Sample CURL API request for contributor.io.
curl "www.contributor.io/api?github=eighttrackmind&npm=bcherny&gem=bcherny"
@bcherny
bcherny / favicon.html
Created December 2, 2013 01:24
100% cross browser favicon declaration
<!--
favicons (see http://www.jonathantneal.com/blog/understand-the-favicon)
---
icon format dimensions documentation
---- ------ ---------- -------------
apple-touch-icon PNG 152x152 https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html#//apple_ref/doc/uid/TP40006556-CH27-SW1
icon PNG 96x96
shortcut icon ICO 32x32
msapplication-TileImage PNG 144x144
@bcherny
bcherny / server.py
Created December 14, 2013 22:17
playing around with a flask server
# imports
from flask import Flask
import urllib
# instantiate server
app = Flask(__name__)
# vars
url ='http://snapguide.com/api/v1/guide/b995492d5e7943e3b2757a88fe3ef7c6'