Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
⭐️ 🚀 🍻 🍶

kazu69 kazu69

:octocat:
⭐️ 🚀 🍻 🍶
View GitHub Profile
@kazu69
kazu69 / Gruntfile.js
Last active Aug 29, 2015
load-grunt-config sample
View Gruntfile.js
module.exports = function(grunt, options) {
var path = require('path');
require('load-grunt-config')(grunt, {
configPath: path.join(process.cwd(), 'grunt'), //path to task.js files, defaults to grunt dir
init: true, //auto grunt.initConfig
config: { //additional config vars
test: false
},
loadGruntTasks: { //can optionally pass options to load-grunt-tasks. If you set to false, it will disable auto loading tasks.
config: require('./package.json'),
View SassMeister-input.scss
// ----
// Sass (v3.3.0.rc.4)
// Compass (v1.0.0.alpha.18)
// ----
@function color-diff($color-a, $color-b) {
$hue: hue($color-a) - hue($color-b);
$saturation: saturation($color-a) - saturation($color-b);
$lightness: lightness($color-a) - lightness($color-b);
View Gruntfile.coffee
###
css-sprite
https://github.com/kazu69/css-sprite
Copyright (c) 2014 kazu69
Licensed under the MIT license.
###
module.exports = (grunt) ->
'use strict'
View convert.sh
# cson to json
node_modules/cson/bin/cson2json data.cson
{"abc":["a","b","c"],"a":{"b":"c"}}
node_modules/cson/bin/json2cson data.json
{
abc: [
"a"
"b"
"c"
View convert.sh
node_modules/json5/lib/cli.js -c data.json5
cat data.json
{
"foo": "bar",
"while": true,
"this": "is a multi-line string",
"here": "is another",
"hex": 3735928559,
"half": 0.5,
"delta": 10,
@kazu69
kazu69 / SassMeister-input.scss
Created Mar 9, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.3.0)
// Compass (v1.0.0.alpha.18)
// ----
.badge {
@at-root .info { content: 'info'; }
@at-root .info {
.page {
content: 'page';
@kazu69
kazu69 / example.js
Last active Aug 29, 2015
koa.js yield order
View example.js
var koa = require('koa');
var app = koa();
app.use(function *(next){
console.log(1);
yield next;
console.log(6);
});
@kazu69
kazu69 / d.js
Created Mar 12, 2014
ES6 generators function
View d.js
function* double(x) {
while(true) {
x = x * 2;
yield x;
}
}
var g = double(2);
console.log(g.next()); // # => 4
console.log(g.next()); // # => 8
@kazu69
kazu69 / error.js
Created Mar 12, 2014
koa.js error handling sample
View error.js
var koa = require('koa');
var app = koa();
app.use(function *(next){
try {
yield next;
}
catch (err) {
console.log(err);
this.status = err.status || 500;