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
@jonschlinkert
jonschlinkert / assemblefile.md
Last active February 8, 2024 08:26
How to create a project with Assemble v0.6.0

assemblefile.js

This is a fairly complete assemblefile

Shows how to:

  • load templates
  • use tasks with plugins
  • use middleware
  • register helpers
@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",

Easiest Table of Contents possible

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

<!-- toc -->

Done!

@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")
})
@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();
}
@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;
@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

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

@akhoury
akhoury / handlebars-helper-x.js
Last active February 17, 2024 13:25
Handlebars random JavaScript expression execution, with an IF helper with whatever logical operands and whatever arguments, and few more goodies.
// for detailed comments and demo, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381
/* a helper to execute an IF statement with any expression
USAGE:
-- Yes you NEED to properly escape the string literals, or just alternate single and double quotes
-- to access any global function or property you should use window.functionName() instead of just functionName()
-- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later
<p>
{{#xif " name == 'Sam' && age === '12' " }}
BOOM