This file contains 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
/* | |
This will create a file and trigger a download for the user. | |
*/ | |
var a = window.document.createElement('a'); | |
a.href = window.URL.createObjectURL(new Blob(['This is the text in the file..'], {type: 'text/html'})); | |
a.download = 'filename_test.html'; | |
// Append anchor to body. | |
document.body.appendChild(a) |
This file contains 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
// tamper script to add a live filter input next to search | |
const $table = $('table.task-list') | |
const $tableBody = $table.find('tbody') | |
const $filterInput = $('<input type="search" placeholder="filter"/>') | |
const filterInput = inputText => { | |
if (!inputText || inputText.length < 3) { | |
$tableBody.find('tr.hidden').map((i, el) => { | |
$(el).removeClass('hidden') | |
}) | |
return |
This file contains 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 winston = require('winston'); // https://github.com/flatiron/winston | |
var logger = new (winston.Logger)({ | |
transports: [ | |
new (winston.transports.Console)(), | |
new (winston.transports.File)({ filename : 'winston.log', timestamp: true, /*maxsize: 2000, maxFiles: 5*/ }) | |
] | |
}); | |
process.on('uncaughtException', function (err) { |
This file contains 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
image: node:7 | |
pipelines: | |
default: | |
- step: | |
script: | |
- printf "//`node -p \"require('url').parse(process.env.NPM_REGISTRY_URL || 'https://registry.npmjs.org').host\"`/:_authToken=${NPM_TOKEN}\nregistry=${NPM_REGISTRY_URL:-https://registry.npmjs.org}\n" >> ~/.npmrc | |
- npm publish |
This file contains 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
module.exports = function(grunt) { | |
"use strict"; | |
grunt.initConfig({ | |
pkg : grunt.file.readJSON("package.json"), | |
paths : { | |
src : "<%= pkg.main %>", |
This file contains 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
/* Place model */ | |
module.exports = { | |
attributes: { | |
name: { | |
type: 'string', | |
required: true | |
}, |
This file contains 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
/** | |
* Locations.js | |
* | |
* @description :: TODO: You might write a short summary of how this model works and what it represents here. | |
* @docs :: http://sailsjs.org/#!documentation/models | |
*/ | |
module.exports = { | |
seedData:[ |
This file contains 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
module.exports = function(duration) { | |
return function(){ | |
return new Promise(function(resolve, reject){ | |
setTimeout(function(){ | |
resolve(); | |
}, duration) | |
}); | |
}; | |
}; |
This file contains 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
/* ------------------------------------------ | |
Alternative impl. as a class can be found here: https://gist.github.com/sidola/eaf987d8c4c7e8445b61dc07c33a842f | |
Has a way smaller footprint and less typescript magic to grasp. | |
------------------------------------------ */ | |
/** | |
* Defines the function type of the publish function. | |
* |
This file contains 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 log(target, key, descriptor: PropertyDescriptor) { | |
var originalMethod = descriptor.value; | |
descriptor.value = function(...args: any[]) { | |
let functionName = key; | |
console.log(functionName + "(" + args.join(", ") + ")"); | |
let result = originalMethod.apply(this, args); | |
console.log("=> " + result); | |
return result; | |
}; |
OlderNewer