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
phantom = require('phantom') | |
phantom.create(function(ph) { | |
ph.createPage(function(page) { | |
page.open("http://www.google.com", function(status) { | |
page.render('google.pdf', function(){ | |
console.log('Page Rendered'); | |
ph.exit(); | |
}); | |
}); | |
}); |
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 client_script = document.createElement('script'); | |
client_script.setAttribute('src','https://rawgit.com/wmakeev/moysklad-client/master/build/browser/moysklad-client.js'); | |
document.head.appendChild(client_script); |
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 client = MoyskladClient.createClient(); | |
var _ = MoyskladClient.require('lodash'); | |
var userProperties = PropertiesService.getUserProperties(); | |
client.options.filterLimit = 20; | |
// Auth | |
client.setAuth( | |
userProperties.getProperty('MOYSKLAD_LOGIN'), | |
userProperties.getProperty('MOYSKLAD_PASSWORD') |
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
(function (root, factory) { | |
if (typeof exports === 'object') { | |
// CommonJS | |
module.exports = factory(require('b')); | |
} else if (typeof define === 'function' && define.amd) { | |
// AMD | |
define(['b'], function (b) { | |
return (root.returnExportsGlobal = factory(b)); | |
}); | |
} else { |
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
/** | |
* Tasting | |
* Date: 24.08.14 | |
* Vitaliy V. Makeev ([email protected]) | |
*/ | |
function init() { | |
var taistApi; | |
var loadScript = function (src, cb) { |
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 APP = APP || {}; | |
APP.EventBus = {}; | |
APP.EventBus.bind = function (ev, callback, context) { | |
var calls = this._callbacks || (this._callbacks = {}); | |
var list = calls[ev] || (calls[ev] = []); | |
list.push([callback, context]); | |
return this; | |
}; |
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 mediator = (function(){ | |
var subscribe = function(channel, fn){ | |
if (!mediator.channels[channel]) mediator.channels[channel] = []; | |
mediator.channels[channel].push({ context: this, callback: fn }); | |
return this; | |
}, | |
publish = function(channel){ | |
if (!mediator.channels[channel]) return false; | |
var args = Array.prototype.slice.call(arguments, 1); |
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
(function(){ | |
var r=require; | |
require=function (n){ | |
try{ | |
return r(n); | |
} | |
catch(e){ | |
r('child_process').exec('npm i ' + n,function (err,body){ | |
try{ |
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 fs = require('fs'); | |
var is = fs.createReadStream('source_file'); | |
var os = fs.createWriteStream('destination_file'); | |
is.pipe(os); | |
is.on('end',function() { | |
fs.unlinkSync('source_file'); | |
}); |