Skip to content

Instantly share code, notes, and snippets.

View mikefowler's full-sized avatar

Mike Fowler mikefowler

View GitHub Profile
@mikefowler
mikefowler / mq.scss
Created October 3, 2012 18:40
Retina Media Queries for Sass
// Based on Chris' post here: https://gist.github.com/3828790
@mixin respond-to($size) {
// Small
@if $size == "small" {
@media only screen and (min-width: 320px) {
@content;
}
@mikefowler
mikefowler / LinkValidation.js.coffee
Created December 7, 2012 23:23
Link validation class
#
# Coffeescript + Underscore syntactic sugar makes this so gracefully concise.
#
class LinkValidation
constructor: ->
@VALID_SERVICES = [
"flickr.com\/photos\/[a-z0-9_-]+\/(\d+)"
getRandomColor: ->
number = Math.floor(Math.random() * (3 - 1 + 1)) + 1
switch number
when 1 then "#983a30"
when 2 then "#187598"
# why not
getRandomColor: -> ["#983a30", "#187598"][Math.ceil(Math.random() * 3)]
@mikefowler
mikefowler / StartView.js.coffee
Created December 28, 2012 02:56
Defining RequireJS modules + Coffeescript classes with the RequireJS sugar syntax. More detail here: http://requirejs.org/docs/whyamd.html#sugar
define (require) ->
$ = require 'jquery'
_ = require 'underscore'
Backbone = require 'backbone'
Handlebars = require 'handlebars'
View = require 'lib/view'
startTemplate = require 'text!templates/start.html'
class StartView extends View
@mikefowler
mikefowler / .bash_profile
Last active December 17, 2015 03:09
Do you clone a lot of Github repositories from Terminal? If you do, you'll probably dig this.
# USAGE
#
# > clone chriseppstein/compass
#
# Cloning into 'compass'...
githubclone() {
git clone [email protected]:$1.git;
}
@mikefowler
mikefowler / .bash_profile
Last active December 18, 2015 04:08
A bash method for quickly showing or hiding hidden files in OSX.
# USAGE
#
# $ hidden TRUE/FALSE
showHidden() { defaults write com.apple.finder AppleShowAllFiles $1 && killall Finder; }
alias hidden=showHidden
@mikefowler
mikefowler / .bash_profile
Created January 14, 2014 21:06
A handy Bash alias to run a JavaScript console in your terminal.
# Launches a native JavaScript terminal
alias js="/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Resources/jsc"
@mikefowler
mikefowler / SassMeister-input.scss
Created October 27, 2014 22:42
Generated by SassMeister.com.
// ----
// Sass (v3.4.6)
// Compass (v1.0.1)
// ----
%stuff {
padding: 10px;
}
.stuff {
@mikefowler
mikefowler / gist:d5ae4445cd2c9001f319
Last active August 29, 2015 14:08
My own little Vim cheatsheet.

Navigation

  • ^ — Jump to the beginning of the current line
  • $ — Jump to the end of the current line
  • G — Go to end of file
  • 5G — Go to line 5

Buffers

  • bw — Close the current buffer
@mikefowler
mikefowler / SassMeister-input.scss
Last active August 29, 2015 14:09
Generated by SassMeister.com.
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
$screen-md: 768px;
$screen-lg: 1100px;
// ----------------------------------------------------------------------------
// Mixins