Skip to content

Instantly share code, notes, and snippets.

@srsgores
srsgores / folding.mixin.less
Created August 26, 2012 22:37
Dynamic Fold LESS Generation
.setColumnWidths(@maxcolumns, @num_cols, @min_resolution){
@media screen and(min-width: @min_resolution) {
.row {
.onecol {
width: percentage(~`Math.min(1, (1 / @{num_cols}*Math.ceil(@{num_cols}*1/@{maxcolumns})))`);
}
.twocol {
width: percentage(~`Math.min(1, (1 / @{num_cols}*Math.ceil(@{num_cols}*2/@{maxcolumns}))) `);
}
.threecol {
@srsgores
srsgores / ajaxify-html5.js
Created August 11, 2012 08:33 — forked from balupton/README.md
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
// https://gist.github.com/854622
(function(window,undefined){
// Prepare our Variables
var
History = window.History,
$ = window.jQuery,
document = window.document;
// Check to see if History.js is enabled for our Browser
@srsgores
srsgores / checkboxable-array.coffee
Created November 26, 2014 20:45
mixin used for checkboxable array
CheckboxableArrayMixin = Ember.Mixin.create
allSelected: false
selectedItems: Ember.computed.filterBy("", "selected", true)
selectedItemsCount: Ember.computed.alias("selectedItems.length")
isEmpty: Ember.computed.not(@get("model"))
@srsgores
srsgores / girlfriend.coffee
Last active August 29, 2015 14:10
A sad reality.
###
Failure of mankind
girlfriend.coffee
@author Sean
@note Created on 2014-11-22 by Sean Goresht
@note uses Codoc
@see https://github.com/coffeedoc/codo
@srsgores
srsgores / dashboard.coffee
Created November 19, 2014 00:25
Authenticated route for a dashboard in EmberJS
`import Ember from "ember"`
DashboardRoute = Ember.Route.extend(
beforeModel: (transition) ->
loginController = @controllerFor("login")
unless loginController.get("isLoggedIn")
loginController.setProperties({
loginFailed: true
attemptedTransition: transition
})
@srsgores
srsgores / form-actions.coffee
Created November 13, 2014 07:49
Action bubbling
`import Ember from "ember"`
FormActionsComponent = Ember.Component.extend(
save: null
classNames: "form-actions",
model: null
redirectRoute: "admin"
icon: "save"
iconClassName: (->
"icon-#{@get("icon")}"
@srsgores
srsgores / form-actions.hbs
Created November 13, 2014 07:24
form actions component
<footer {{bind-attr class="classNames"}}>
<button {{action "didSaveObject"}}>Save {{text}} <i {{bind-attr class="iconClassName"}}></i></button>
{{yield}}
</footer>
@srsgores
srsgores / helpers.styl
Created August 29, 2014 01:58
Trying to dynamically generate placeholders
use("camelize.js")
directions = top left bottom right
properties = margin padding
proportions = mini small normal medium large
positions = fixed absolute static relative
@srsgores
srsgores / helpers.styl
Created August 19, 2014 21:47
Generate Placeholders in Stylus
displays = block inline-block inline table
derps = me myMom myDad smurffy
generatePlaceholder(display, displays)
generatePlaceholder(derp, derps)
body
@extend $block
@extend $smurffy
@srsgores
srsgores / helpers.styl
Created August 19, 2014 21:23
Stylus Dynamic Placeholders
properties = margin padding
proportions = mini small normal medium large
directions = top left bottom right
$smallmargintop = 1.3em
for property in properties
for proportion, i in proportions