Skip to content

Instantly share code, notes, and snippets.

View afucher's full-sized avatar

Arthur Fücher afucher

View GitHub Profile
"use strict";
var path = require("path");
var fs = require("fs");
var Twit = require('twit');
var rateLimiter = {};
var luckyNumber = Math.round(Math.random()*60);
var re = /\d+/;
var oauth = JSON.parse(fs.readFileSync("./config/twitter_credentials.js", "UTF8"));
@afucher
afucher / gist:1b59c976aa41a1af6621
Created March 5, 2015 14:11
Retorna response de http.get no lugar do response da minha rota
express.get('/', function(req, res){
http.get('www.outrolugar.com.br/api/', function(response){
//Posso fazer isso???
//Ou como faço algo parecido
res = response;
res.end();
})
})
@afucher
afucher / app.js
Last active August 29, 2015 14:28
Echo from bat file
(function() {
var childProcess = require("child_process");
var oldSpawn = childProcess.spawn;
function mySpawn() {
console.log('spawn called');
console.log(arguments);
var result = oldSpawn.apply(this, arguments);
return result;
}
childProcess.spawn = mySpawn;
var async = require('async');
function copyFileToStructure(filename, done){
async.parallel([
async.apply(teste, filename , 'param'),
async.apply(teste, filename , 'param')
], function(result) {
console.log("poa");
console.log(done);
done();
@afucher
afucher / iniFileParser.js
Created February 4, 2016 00:25
Grammar from PEGjs for ini file
IniFile
= first: Section (BlankLine* others: Section*) {others.unshift(first); return others; }
Section
= section: SectionHeader "\n" values: KeyValues* {return {section:values}}
SectionHeader
= "[" section_name: word "]" {return section_name}
KeyValues
= a: word "=" value: word "\n"? {var o = {}; o[a]=value; return o;}
alias workrebase="git checkout master && git pull origin master && git checkout work && git rebase master"
alias worksync="workrebase && git checkout master && git merge work && git push origin master && git checkout work"
alias workghpagesrebase="git checkout gh-pages && git pull origin gh-pages && git checkout work && git rebase gh-pages"
alias workghpagessync="workghpagesrebase && git checkout gh-pages && git merge work && git push origin gh-pages && git checkout work"
'use strict';
var schedAPI = require('./schedAPI');
var handlebars = require("handlebars");
var fs = require('fs');
var partialsDir = __dirname + '/template/partials';
var XLSX = require('xlsx');
var Excel = require('exceljs');
/** Retorna as informações do sched e gera as placas em html */
schedAPI.getSessionExport((err,session) => {
@afucher
afucher / gist:8d75c48f2084caa09e12bc7aad8ce496
Created November 23, 2016 15:37
hapi-auth-cookie-error
"use restrict";
const Hapi = require('hapi');
const CookieAuth = require('hapi-auth-cookie');
const server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 3000
});
'use strict';
import Vue from 'vue';
export default {
getCourses() {
return Vue.resource('/courses').get();
},
putCourses(){
return Vue.resource('/courses').put();
const webpack = require('webpack');
const compiler = webpack(require('./webpack.config'));
compiler.watch({ // watch options:
aggregateTimeout: 300, // wait so long for more changes
poll: true // use polling instead of native watchers
// pass a number to set the polling interval
}, function(err, stats) {
console.log(stats.toString());