Skip to content

Instantly share code, notes, and snippets.

Eric Miller SimplGy

Block or report user

Report or block SimplGy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SimplGy
SimplGy / twoWaysToTestVars.js
Created Apr 3, 2012
Comparison of two ways to check for bad data in a method
View twoWaysToTestVars.js
//------------------ Option A: Use if else to avoid execution of bad data
// panelData = {
// title: "a title for the panel (optional)"
// subtitle: "subtitle for the panel (optional)"
// contents: "panel contents (required)"
// }
_addPanel = function (panelData) {
var $panel
, panelPos
View post-receive.rb
#!/usr/bin/env ruby
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome
# - Ryan Florence (http://ryanflorence.com)
#
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'
@SimplGy
SimplGy / runner.js
Created Feb 28, 2013
Updated PhantomJS QUnit runner to support RequireJS and CurlJS modules, which can load *after* QUnit.done is called. Also improved the console output and added a global timeout. If your test suite takes longer than `timeLimit` to run, it'll fail.
View runner.js
/*
* QtWebKit-powered headless test runner using PhantomJS
*
* PhantomJS binaries: http://phantomjs.org/download.html
* Requires PhantomJS 1.6+ (1.7+ recommended)
*
* Run with:
* phantomjs runner.js [url-of-your-qunit-testsuite]
*
* e.g.
View Date.prototype.coffee
Date.prototype.addHours = (h) ->
date = new Date @
date.setHours @getHours() + h
date
Date.prototype.isWeekday= ->
weekdays = [1..5] # Javascript days are integers from 0-6 starting at Sunday
debugger
_.contains weekdays, @.getDay()
@SimplGy
SimplGy / app.analytics.coffee
Last active Jan 4, 2016
Abstraction for an SPA's Analytics Library
View app.analytics.coffee
define(
[]
() ->
_analyticsSites =
DEMO: 1
LOCALHOST: 2
_libUrl = (server) ->
'js!' + server + '/js/piwik.js'
@SimplGy
SimplGy / brandColors.sass
Created May 16, 2013
Brand Colors in a sass file for easy use in stylesheets. Feel free to add to this list :)
View brandColors.sass
// brandcolors.net
$colorFacebook: #3b5998
$colorFitbit: #48c1c4
$colorLinkedIn: #0e76a8
$colorGoogle: #db4a39
$colorTwitter: #00acee
@SimplGy
SimplGy / bootstrapButtonOverrider.sass
Created May 16, 2013
Factory for creating bootstrap button overrides using sass. Used for, say, changing the color of the '.btn-primary' bootstrap button.
View bootstrapButtonOverrider.sass
// This is a bootstrap button factory. Give it a class name and a color and it will build you a shiney bootstrap button override. Wowz.
// usage: +magicalButton('btn-green', green)
@mixin magicalButton($btnClassName: 'defaultPink', $color: #f66, $shading: 15, $highlighting: 10)
#{$btnClassName}
@include linear-gradient( $color, $color - $shading )
#{$btnClassName}:hover, #{$btnClassName}:focus
@include linear-gradient( $color + $highlighting, $color - $shading )
#{$btnClassName}:active, #{$color}.active
@include linear-gradient( $color + $highlighting*2, $color - $shading )
#{$btnClassName}.disabled, #{$btnClassName}[disabled]
@SimplGy
SimplGy / rockerButton.sass
Last active Dec 17, 2015
SASS styles for an image free rocker switch button for yes/no or similar 2 option choices. It's tricky in part because it's the `.active` state that has little styling, but the inactive state has transforms and other wonkiness. Output looks like this: http://i.imgur.com/twwQM3e.png
View rockerButton.sass
// Result: http://i.imgur.com/twwQM3e.png
@import '../bower_components/bourbon/app/assets/stylesheets/_bourbon.scss'
$colorBackbground: whitesmoke
$colorForeground: #333
$colorGood: springgreen
$radiusSmall: 4px
$spaceTiny: 3px
$spaceLil: 10px
@SimplGy
SimplGy / animationPlay
Last active Dec 18, 2015
SASS Animation Play
View animationPlay
$colorGood: lawngreen
.circle
background: $colorGood
.circle.yay
+animation( blammo .5s )
+keyframes(blammo)
@SimplGy
SimplGy / screenSizeHelpers.sass
Last active Dec 20, 2015
Allows you to use simple block statements to conditionally target +phone, +desktop, and +tablet
View screenSizeHelpers.sass
$sizePhone: 603px
$sizeTablet: 1024px
@mixin phone
@media (max-width: $sizePhone)
@content
@mixin tablet
@media (min-width: $sizePhone+1) and (max-width: $sizeTablet)
@content
You can’t perform that action at this time.