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 generatePreview(fileObj, readStream, writeStream) { | |
| fileObj.name('preview.jpg', { | |
| store: 'thumbs' | |
| }); | |
| fileObj.extension('jpg', { | |
| store: 'thumbs' | |
| }); | |
| fileObj.type('image/jpg', { | |
| store: 'thumbs' | |
| }); |
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
| db['cfs.medias.filerecord'].aggregate( | |
| [ | |
| { | |
| $project: | |
| { | |
| year: { $year: "$uploadedAt" }, | |
| month: { $month: "$uploadedAt" }, | |
| day: { $dayOfMonth: "$uploadedAt" }, | |
| hour: { $hour: "$uploadedAt" }, | |
| minutes: { $minute: "$uploadedAt" }, |
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'), | |
| schedule = require('node-schedule'), | |
| currentfilename = '/Users/gabrielstuff/Desktop/default/iehg', | |
| newFilename = '/Users/gabrielstuff/Desktop/default/video', | |
| extension = 'mp4', | |
| number = 0; | |
| function rename() { | |
| fs.rename(currentfilename+'.' + extension, newFilename + '_' + number + '.' + extension, function(err) { | |
| if (err) { |
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'), | |
| videoName = './record_10.mp4', | |
| child_process = require("child_process"), | |
| exec = child_process.exec; | |
| /*This works like a charm*/ | |
| var ffmpeg = child_process.spawn("ffmpeg", [ | |
| '-i', videoName, // path | |
| '-vf', 'thumbnail,scale=640:360', | |
| '-r', '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
| Router.map(function() { | |
| this.route('messages', { | |
| path: '/api/messages', | |
| where: 'server', | |
| action: function() { | |
| xml2js = Meteor.npmRequire('xml2js'); | |
| // GET, POST, PUT, DELETE | |
| var req = this.request; | |
| var res = this.response; |
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 getCanvasURL(canvas){ | |
| var parts = canvas.toDataURL().match(/data:([^;]*)(;base64)?,([0-9A-Za-z+/]+)/); | |
| //assume base64 encoding | |
| var binStr = atob(parts[3]); | |
| //convert to binary in ArrayBuffer | |
| var buf = new ArrayBuffer(binStr.length); | |
| var view = new Uint8Array(buf); | |
| for (var i = 0; i < view.length; i++) |
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
| private function recursiveCheck($array) | |
| { | |
| $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($array), | |
| RecursiveIteratorIterator::SELF_FIRST); | |
| foreach ($iterator as $key => $current) { | |
| $keyValid = array('section', 'block', 'text', 'item'); | |
| if(in_array($key, $keyValid) && $key !== 0 && $this->is_assoc($current)){ | |
| //error_log('key: '.$key); | |
| $prevValue = $iterator->getInnerIterator()->offsetGet( $key ); | |
| $iterator->getInnerIterator()->offsetUnset($key); |
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
| Meteor.methods({ | |
| 'imapConnect': function(email, password) { | |
| var fut = new Future(), | |
| imap = new Imap({ | |
| user: email, | |
| password: password, | |
| host: host, | |
| port: port, | |
| tls: tls, |
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
| Meteor.call('getFile', 'ksxxxx.domain.com', 80, '/path/last.gif', function(res, err){ | |
| console.log('YEAH: '+res); | |
| }); |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |