Skip to content

Instantly share code, notes, and snippets.

View gorillawit's full-sized avatar

rspeed gorillawit

  • sunpower
  • Austin TX
View GitHub Profile
@gorillawit
gorillawit / FatArrow-SkinnyArrow.coffee
Last active December 18, 2015 05:29
when to go fat and when to go thin in coffeescript
class SomeAjaxCallback
constructor: (@value) ->
throw "Bad value" unless value?
setTimeout @process, 5000
# setTimeout doesn't give us a "new context"
# so we'd get our "global context" : window
# let's avoid that use the fat arrow
process: =>
throw "Wrong context" unless @value?
@gorillawit
gorillawit / Guardfile.rb
Last active December 18, 2015 08:59
Gaurdfile template
guard 'coffeescript', :input => 'coffee', :output => '../source/views', :source_map => true, :source_root => '../../kaybus-control/coffee'
# source_map should be relative to the destination of the js file
# not quite working without config file
guard 'compass', :input => 'sass', :output => '../source/css' do
watch('(.*)\.scss')
end
guard 'haml' do
watch('index.haml')
@gorillawit
gorillawit / simple-haml-boiler.haml
Last active December 18, 2015 13:48
simple index.haml file
!!!
%html
%head
%meta{:charset => "utf-8"}
%title Title
%meta{:content => 'width=device-width, initial-scale=1', :name => 'viewport'}
%link{:href => "css/style.css", :rel => "stylesheet"}
/[if IE]
%script{:src => 'http://html5shim.googlecode.com/svn/trunk/html5.js'}>
%body
@gorillawit
gorillawit / GuardfileStatic.rb
Last active December 18, 2015 13:48
simple Guardfile for static sites
guard 'coffeescript', :input => '.', :output => 'js/'
guard 'haml', :output => "." do
watch('index.haml')
end
guard 'livereload' do
watch(%r{(js|html|css)$})
end
@gorillawit
gorillawit / sass-position-mixinz.scss
Last active December 20, 2015 22:38
sass positioning
// ============================================================
// Positioning Mixins
// ------------------------------------------------------------
//**
// Private Mixin: _set-position
// Set the Position for the Position Mixins
//
// @mixin _set-position
// @param $position {list} One Value = top, Two Value = top left, Four Values = top right bottom left (t = zero position) can be in px or %
@gorillawit
gorillawit / placeholders-ifElse-mixins.css
Last active December 26, 2015 02:29
Generated by SassMeister.com.
.my-other-class {
background: url(http://www.placekitten.com/200/200) no-repeat;
}
.my-class {
background: no-kittens;
}
.my-class {
color: green;
@gorillawit
gorillawit / placeholder-extend.css
Last active December 26, 2015 02:29
Using placeholder to show how it can be used to better effect than extend in most cases
.class1, .class2, .class3 {
font-size: 2em;
}
.class3 {
color: green;
}
@gorillawit
gorillawit / menu-with-ie8-exception.css
Last active December 26, 2015 02:39
Sass menu with ie8 exception
menu {
background: #333333;
}
menu .menu-item {
float: left;
}
menu .menu-item .menu-link {
color: blue;
border-right: 1px solid black;
}
@gorillawit
gorillawit / at-root.css
Last active February 8, 2018 13:37
Using @at-root directory to break nested selectors out of media queries and into the root level
/*
@at-root directory is a global sass function that allows @root can be called from
every nested media. @at-root refers to the base level so @at-root = the root that
all media-queries are bound too. ie for every nested media query, this is the
global style for them. NOW! we get to specify them in the latest Sass release,
@at-root: allows us to jump out of our context this is great if you have one
asset that needs to be different that than the others
*/
@media (min-width: 300px) {
.my-widget .inside-mq {
@gorillawit
gorillawit / new-if-statements.css
Last active January 2, 2016 13:19
New simplified if statements in Sass
.ifStatement {
background: green;
}
div {
background: red;
}
div + div {
background: green;
}