Skip to content

Instantly share code, notes, and snippets.

@smcan
smcan / Instructions.md
Created October 20, 2016 06:00 — forked from jodyheavener/Instructions.md
Use Babel (ES6) with Sails JS

Inspired by this issue, with these instructions you should be able to get Babel transpiling your JS in Sails JS for the client side.

  1. Install Grunt Babel npm install --save grunt-babel
  2. Create a babel.js file under tasks/config and add something like the following:
module.exports = function(grunt) {

    grunt.config.set('babel', {
dev: {
@smcan
smcan / gist:86d981bd2a987586c986
Last active August 29, 2015 14:26 — forked from nobuti/gist:3756881
Easy jquery/zepto images preload
var images = ["path/to/image", "path/to/image", ... , "path/to/image"],
preloaded = images.length;
_.each(images, function(img) {
var image = $('<img />').attr('src', img);
image.on('load', function(){
preloaded--;
if (preloaded === 0){
console.log("All preloaded!");
}
@smcan
smcan / API.md
Created July 25, 2013 09:40 — forked from iros/API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@smcan
smcan / gist:3919163
Created October 19, 2012 16:24 — forked from xdstack/gist:3713862
php实现汉字转拼音
$d=array(
array("a",-20319),
array("ai",-20317),
array("an",-20304),
array("ang",-20295),
array("ao",-20292),
array("ba",-20283),
array("bai",-20265),
array("ban",-20257),
array("bang",-20242),