Skip to content

Instantly share code, notes, and snippets.

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

Stefan Walther stefanwalther

🏠
Working from home
View GitHub Profile
@ralfbecher
ralfbecher / Qlik_Sense_example_extension_with_switchable_user_custom_properties.js
Last active September 15, 2015 18:19
Qlik Sense example extension with switchable user custom properties
/**
* @owner Ralf Becher, irregular.bi
*/
define( ["jquery", "qlik"],
function ($, qlik) {
return {
//property panel
definition: {
type: "items",
component: "accordion",
@daniloborges
daniloborges / logger.es6
Last active November 26, 2016 00:21
A simple node module that makes console.log/error/warn/debug/time statements log through winston (simply include at the beginning of your app) ES5/ES6
import * as winston from 'winston';
import * as path from 'path';
let logger = new winston.Logger();
export default {
middleware(req, res, next){
console.log('verbose', req.method, req.url, res.statusCode);
next();
}
@winhamwr
winhamwr / wait_for_vagrant.sh
Created October 23, 2013 17:26
Bash script to wait until a vagrant box is ready
#! /bin/bash
# Sleep until we can successfully SSH into a vagrant box.
# eg. $ wait_for_vagrant devbox && vagrant ssh devbox --command 'cd project && ./manage.py runserver'
# Uses doublinng backoff while waiting
# with_backoff() adapted from http://stackoverflow.com/a/8351489
# Retries a command a configurable number of times with backoff.
#
# The retry count is given by ATTEMPTS (default 5), the initial backoff
@mindspank
mindspank / qsocks.node.connect.js
Last active October 23, 2017 09:15
Very verbose example on how to connect qsocks to a server.
var qsocks = require('qsocks');
var fs = require('fs');
var request = require('request');
//Set our request defaults, ignore unauthorized cert warnings as default QS certs are self-signed.
var r = request.defaults({
rejectUnauthorized: false,
host: 'usrad-akl.qliktech.com',
pfx: fs.readFileSync("C:\\QlikTech\\Demo Team\\Node\\qsocks\\client.pfx")
})

Verb Tags

Built-in tags provided by Verb

Verb "tags" are just Lo-Dash templates, which means you have the power of straight JavaScript in your templates.

Verb offers a number of specialized tags that were created to address common needs, but it's easy to add your own custom tags too.

Built-in tags

@jonschlinkert
jonschlinkert / assemble-middleware-starter.js
Created May 3, 2014 20:41
This is all you need to create middleware for assemble.
module.exports = function (assemble) {
var middleware = function(params, next) {
// do stuff
next();
};
// When do you want the plugin to run?
middleware.event = 'page:after:render';
return {
'assemble-middleware-foo': middleware

Easiest Table of Contents possible

In .verb.md where you want to inject the TOC:

<!-- toc -->

Done!

@border
border / googleFinance.py
Created October 28, 2011 07:03
Access Stock Quotes Realtime through Google Finance
import urllib2
import json
import time
# Form: http://digitalpbk.com/stock/google-finance-get-stock-quote-realtime
class GoogleFinanceAPI:
def __init__(self):
self.prefix = "http://finance.google.com/finance/info?client=ig&q="
def get(self,symbol,exchange):
@xmlking
xmlking / Enum.es6.js
Last active June 25, 2019 18:09
JavaScript Enums with ES6, Type Checking and Immutability
export class EnumSymbol {
sym = Symbol.for(name);
value: number;
description: string;
constructor(name: string, {value, description}) {
if(!Object.is(value, undefined)) this.value = value;
if(description) this.description = description;
@aheckmann
aheckmann / emit.js
Created June 7, 2012 15:25
mongoose update,new,remove events
var mongoose = require('mongoose');
mongoose.connect('localhost', 'testing_emitUpdate');
var Schema = mongoose.Schema;
var schema = new Schema({
name: String
});
// plumbing
schema.pre('save', function (next) {