Skip to content

Instantly share code, notes, and snippets.

(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
@randylien
randylien / SassMeister-input.scss
Created June 4, 2013 19:23
Generated by SassMeister.com, the Sass playground.
// ---
// Sass (v3.2.9)
// ---
/* SASS Training Course
Operations
*/
{
"binary_file_patterns":
[
"*.psd"
],
"close_windows_when_empty": false,
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"detect_indentation": false,
"disable_formatted_linebreak": true,
"drag_text": false,

JavaScript 品質工具:CodePaint 與 Plato

介紹協助提昇 F2E Code Style 的兩個工具。

分享者

josephj@faria

問題

#A simple Slideshow module wrapped in a Backbone View

  • Dependencies ** underscore.js ** backbone.js

Viewable in action in this jsfiddle

define([
'underscore',
'backbone'
],
function (_, Backbone) {
return Backbone.Router.extend({
// Variants of the routes to be automatically bound to. This way you
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();
@import "compass/utilities/sprites"; // Include compass sprite helpers
@import "compass/css3/background-size"; // Include helper to calc background size
@mixin sprite($name, $hover: false, $active: false) {
@include retina-sprite($name, $sprites, $sprites2x, $hover, $active);
}
// The general purpose retina sprite mixin.
//
$bgcolor: hsl(53,56%,87%);
.button-primary {
background: $bgcolor;
color: if(lightness($bgcolor) < 50%, white, black);
}
@randylien
randylien / Gruntfile.js
Created August 24, 2013 17:16
{,*}/ -> **
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'