Skip to content

Instantly share code, notes, and snippets.

View roelvan's full-sized avatar
🏠
Working from home

Roel Vaneyghen roelvan

🏠
Working from home
View GitHub Profile
@roelvan
roelvan / gruntfile
Created July 22, 2013 21:05
missing js property
// The wrapper function
module.exports = function(grunt) {
var SRC_CSS = 'app/css/';
var SRC_CSS_ADMIN = 'app/css/admin/';
var SRC_CSS_LANDING = 'app/css/landing/';
var SRC_JS = 'app/js/';
var SRC_JS_ADMIN = 'app/js/admin/';
var SRC_JS_LANDING = 'app/js/landing/';
var BUILD_CSS = 'web/css/';
# on the server: server.coffee
Metrics = (name, aggregationQuery, collection, interval) ->
@name = name
@aggregationQuery = aggregationQuery
@collection = collection
@interval = interval or 1000*10
@_collectionName = 'metrics-transport'
Metrics.prototype._getCollectionName = -> "metrics-#{@name}"
BEGIN;
INSERT INTO warehouse.rental_transport_routes
(ride_no, sequence_no, driver_emp_id, ride_date, from_latitude, from_longitude, to_latitude, to_longitude, ride_type, distance, route_time)
VALUES
(2,1,TEST_V0002,date '2016-01-22',50.7401640000,3.3271730000,50.8614460000,3.4276280000,'actual',25928,1447 ) ,
(2,2,TEST_V0002,date '2016-01-22',50.8614460000,3.4276280000,50.6102640000,5.5416590000,'actual',179618,6378 ) ,
(2,3,TEST_V0002,date '2016-01-22',50.6102640000,5.5416590000,50.7401640000,3.3271730000,'actual',196438,6996 ) ,
(2,1,TEST_V0002,date '2016-01-22',50.7401640000,3.3271730000,50.8599400000,3.4272200000,'Simul 1',26214,1484 ) ,
(2,2,TEST_V0002,date '2016-01-22',50.8599400000,3.4272200000,50.7401640000,3.3271730000,'Simul 1',26882,1471 ) ,
(2,3,TEST_V0002,date '2016-01-22',50.8614460000,3.4276280000,50.8614460000,3.4276280000,'Simul 1',0,0 ) ,
postRoutes.route '/api/process-payment', (params, req, res, next) ->
res.statusCode = 404
res.setHeader 'Content-Type', 'application/x-www-form-urlencoded'
paymentId = req.body.id
console.log "====== MOLLIE BODY ======"
console.log req.body, params
console.log "====== MOLLIE BODY ======"
mollieApiKey = Meteor.settings.mollie.apiKey
mollie = new Mollie.API.Client
mollie.setApiKey mollieApiKey
var socket = io();
var app = feathers();
app.configure(feathers.socketio(socket));
var taskService = app.service('tasks');
Vue.component('app-segment', {
template: '#segment-template',
props: ['task'],
methods: {
@roelvan
roelvan / 0_reuse_code.js
Created October 13, 2016 04:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@roelvan
roelvan / index.js
Created February 1, 2017 03:25
Extract first name from an array of email addresses.
const _ = require('lodash')
const fs = require('fs')
const json2csv = require('json2csv')
const emails = [
"[email protected]"
]
const mappedMails = _.compact(_.map(emails, email => {
const firstName = _.capitalize(email.split('.')[0])
if (firstName.indexOf('@') < 0) {
@roelvan
roelvan / readme.md
Last active May 28, 2017 11:48
Cheatsheet for Vietnamese Telex Keyboard Input. Can be added to Alfred for Mac.
  1. install cheatset: sudo gem install cheatset --no-ri --no-rdoc
  2. compile file: cheatset generate telex.rb
@roelvan
roelvan / tickets.class.js
Last active November 28, 2017 07:23
Generate PDF's and Barcodes with Feathers.js
const errors = require('feathers-errors');
const PDFDocument = require('pdfkit');
const bwipjs = require('bwip-js');
/* eslint-disable no-unused-vars */
class Service {
constructor (options) {
this.options = options || {};
}
// Initialize our service with any options it requires
app.use('/tickets', createService(options), (req, res) => {
const doc = res.data;
doc.pipe(res);
return res.format({ 'application/pdf': () => doc.end() });
});