This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://developer.mozilla.org/en/docs/Web/API/MutationObserver | |
// create an observer instance | |
var observer = new MutationObserver(function(mutations) { | |
console.log(mutations); | |
}); | |
// configuration of the observer: | |
var config = { | |
attributes: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Start off with a promise that always resolves | |
var sequence = Promise.resolve(); | |
// Loop through our chapter urls | |
story.chapterUrls.forEach(function(chapterUrl) { | |
// Add these actions to the end of the sequence | |
sequence = sequence.then(function() { | |
return getJSON(chapterUrl); | |
}).then(function(chapter) { | |
addHtmlToPage(chapter.html); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var npm = require('npm'); | |
var pkg = require('../package'); | |
npm.load(pkg, function (err) { | |
if (err) throw err; | |
npm.commands.install(['have'], function (err) { | |
if (err) throw err; | |
console.log('Packages installed'); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://habrahabr.ru/post/250645/ | |
# rename origin remote | |
git remote rename origin github | |
# add the gitlab remote (for the love of everything that’s holy, use ssh) | |
git remote add bitbucket <remote link for bitbucket> | |
# push existing code to new remote | |
git push -u bitbucket —all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp') | |
, fs = require('fs') | |
, browserify = require('browserify') | |
, watchify = require('watchify') | |
, reactify = require('reactify') | |
, insert = require('gulp-insert') | |
, source = require('vinyl-source-stream') | |
; | |
function handleError(name) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @namespace DriveApp | |
* @property {function} searchFiles | |
*/ | |
/** | |
* @namespace Utilities | |
* @property {function} formatString | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SomeClass = function (options) { | |
if ( ! (this instanceof SomeClass)) { | |
return new SomeClass(options); | |
} | |
// code | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn group-by [f] | |
(fn [rf] | |
(let [groupped-value (volatile! (transient {}))] | |
(fn | |
([] (rf)) | |
([result] | |
(rf (rf result (persistent! @groupped-value)))) | |
([result input] | |
(let [key (f input)] | |
(vswap! groupped-value assoc! key (conj (get @groupped-value key []) input)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Map = function(f, xf) { | |
this.f = f; | |
this.xf = xf; | |
}; | |
Map.prototype.init = function() { | |
return this.xf.init(); | |
}; | |
Map.prototype.result = function(result) { | |
return this.xf.result(result); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var processFile = require('file-processsor'); | |
module.exports = function(sb) { | |
return { | |
init: function(options) { | |
sb.on('new-file', function(ch, file, next) { | |
processFile(file).then(function (processedFile) { | |
sb.send('file', processedFile, function (err, result) { | |
if (err) { | |
sb.emit('error', err); |