Skip to content

Instantly share code, notes, and snippets.

View floatdrop's full-sized avatar
🐒

Vsevolod Strukchinsky floatdrop

🐒
View GitHub Profile
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var watch = require('gulp-watch');
var less = require('gulp-less');
gulp.task('watch:src', function() {
watch({glob: 'styles/**/*.less'}, function(files) {
return gulp.start('styles:src');
});
});
@floatdrop
floatdrop / gist:89088fe512f46fb92949
Last active August 29, 2015 14:04
BH IS AWESOME
var bh = new (require('bh').BH)();
bh.match('button', function(ctx) {
ctx.mix({block: 'i-global'});
});
bh.match('button', function(ctx) {
return [
'2',
ctx.json(),
ctx.json(),
ctx.json(),
var Controller = function (name) {
if (!name) {
return new Error('Controller name is not defined!');
}
var controller = this.controller = require('./' + name);
Object.keys(controller).forEach(function (method) {
this.setMethod(method);
}.bind(this));
'use strict';
var gulp = require('gulp'),
gutil = require('gulp-util'),
jscs = require('gulp-jscs'),
jshint = require('gulp-jshint'),
tslint = require('gulp-tslint'),
typedoc = require('gulp-typedoc'),
react = require('gulp-react'),
typescript = require('gulp-tsc'),
'use strict';
var gulp = require('gulp'),
gutil = require('gulp-util'),
tslint = require('gulp-tslint'),
typescript = require('gulp-tsc'),
watch = require('gulp-watch'),
plumber = require('gulp-plumber'),
//livereloadEmbed = require('gulp-embedlr'),
// Include gulp
var gulp = require('gulp');
// Include plugins
var watch = require('gulp-watch');
var plumber = require('gulp-plumber');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
var rename = require('gulp-rename');
@floatdrop
floatdrop / index.js
Created June 24, 2014 04:00
Gaze test
// Do `npm i gaze` before running this
var gaze = require('gaze');
// Watch all .js files/dirs in process.cwd()
gaze('src/images/**/*', function(err, watcher) {
this.on('all', function(event, filepath) {
console.log(filepath + ' was ' + event);
});
});
@floatdrop
floatdrop / jox.js
Created June 24, 2014 03:41
xml2js validation
'use strict';
var Joi = require('joi');
function attrs (keys) {
return Joi.object().keys({
__attr: Joi.compile(keys).required()
});
}
@floatdrop
floatdrop / gulp-watch-inject.js
Created June 20, 2014 04:54
Rebuilding index.html with gulp-inject on scss file changes
'use strict';
var watch = require('gulp-watch'),
inject = require('gulp-inject'),
sass = require('gulp-sass'),
gulp = require('gulp'),
es = require('event-stream');
gulp.task('default', function () {
watch({glob: 'sass/*.scss'}, function(scss) {
var onError = function (err) {
gutil.beep();
console.log(err);
};
gulp.task('styles', function () {
gulp.src('scss/style.scss')
.pipe(plumber(onError)
.pipe(rubysass())
.pipe(gulp.dest('dist/'));