Preface: Not a Meteor Expert. Please comment with improvements.
Paraphrasing philosophy:
- Hoodie, Look ma! No Backend.
- Meteor, Backend Power on the Fronend.
A couple of high-level observations:
mergesort = (input) -> | |
n = input.length | |
if n == 1 | |
return input | |
pivot = Math.floor n/2 | |
a = mergesort input[0...pivot] # coffee script does not include the last element in a slice | |
b = mergesort input[pivot...n] | |
merge(a, b) | |
merge = (a, b) -> |
// Placeholder @mixin for Sass | |
// | |
// A mixin to style placeholders in HTML5 form elements. | |
// Includes also a .placeholder class to be used with a polyfill e.g. | |
// https://github.com/mathiasbynens/jquery-placeholder | |
// Requires Sass 3.2. | |
// | |
// Example usage (.scss): | |
// | |
// input { |
@events = | |
events: {} | |
on: (topic, handler, context = this) -> | |
(@events[topic] or= []).push {handler, context} | |
trigger: (topic, args...) -> | |
return unless @events[topic]? | |
handler.apply(context, args) for {handler, context} in @events[topic] |
// 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 |
img.grayscale.disabled { | |
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale"); | |
-webkit-filter: grayscale(0%); | |
} |
# A class-based template for jQuery plugins in Coffeescript | |
# | |
# $('.target').myPlugin({ paramA: 'not-foo' }); | |
# $('.target').myPlugin('myMethod', 'Hello, world'); | |
# | |
# Check out Alan Hogan's original jQuery plugin template: | |
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template | |
# | |
(($, window) -> |
var App = angular.module('App', []); | |
App.controller('TodoCtrl', function($scope, $http) { | |
$http.get('todos.json') | |
.then(function(res){ | |
$scope.todos = res.data; | |
}); | |
}); |
@em: 1em; | |
@multiplierLarge: 2.3; | |
@multiplier: 2; | |
.headingsX(@index) when (@index > 0) { | |
(~"h@{index}") { | |
font-size: ((@em * @multiplierLarge) - ((@index * ((@em * @multiplierLarge) / 6 )))) + (@em * @multiplier); | |
} | |
.headingsX(@index - 1); | |
} |
// | |
// Style any number of headings in one fell swoop: | |
// This is not yet supported by Stylus, see https://github.com/LearnBoost/stylus/issues/608 for more information. | |
headings(1..6) | |
for heading in headings() | |
h{{heading}} | |
@content |