Skip to content

Instantly share code, notes, and snippets.

@timaschew
timaschew / index.js
Created July 22, 2016 11:27
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const DEEPSTREAM_HOST = 'deepstream-eu.herokuapp.com:80'
const deepstream = require('deepstream.io-client-js')
const client = deepstream(DEEPSTREAM_HOST).login({
user: 'requirebin'
}, (success, data) => {
console.log('success', success)
console.log('data', data)
@timaschew
timaschew / manifest.yml
Created July 2, 2016 22:52
openshift nodejs cartridge
Name: nodejs
Description: Custom Node.js cartridge auto-updating to the latest stable version on each build.
Version: '6.2.2'
License: Node.js License
License-Url: https://raw.githubusercontent.com/nodejs/node/master/LICENSE
Vendor: www.nodejs.org
Website: http://www.nodejs.org/
Display-Name: ST Backend
Cartridge-Short-Name: NODEJS
Cartridge-Version: '2.2.5'
const fs = require( 'fs' );
const net = require( 'net' );
const path = require( 'path' );
const os = require( 'os' );
const TEMP_DIR = os.tmpDir();
const SOCKET_FILE = path.join( TEMP_DIR, 'my.sock' );
console.log( SOCKET_FILE );
@timaschew
timaschew / i18n-data-structure.md
Last active October 16, 2018 08:10
i18n support for panini

i18n datastructure

datastructure need to be created before invoking the panini gulp task

Creating the object from a yml file, for each language

 const i18nArray = ['de_DE', ' en_US'].map(lang => {
    const ymlFilePath = path.join(__dirname, '..', SRC_DIRECTORY, 'data/yml', lang) + '.yml'
 try {
@timaschew
timaschew / octokat-stub.js
Created May 6, 2016 09:32
stub for octokat.js
'use strict'
class Spies {
constructor() {
this.db = {}
}
add(name, input, output) {
const item = this.db[name] || {
callCount: 0,
@timaschew
timaschew / fake-data-10.json
Created April 29, 2016 06:44
generate customer fake data with chancejs with a german locale
[
{
"name": "Alexa Stephan",
"gender": "Frau",
"birthday": "1959-05-21",
"email": "[email protected]",
"phone": "0927 68626",
"mobile": "0151 938910204",
"streetName": "Salmengasse",
"houseNumber": 131,
@timaschew
timaschew / freemarker-check.js
Created April 14, 2016 20:31
freemarker regex pattern
const LIST_PATTERN = /<#list\s*(\w*)\s*(\w*)\s*(\w*)>((.|\n)*)<\/#list>/
@timaschew
timaschew / github-helper.js
Created April 14, 2016 06:58
automate a pull request flow via GitHub API - fork, create branch or update from upstream, commit changes, do pull request and optional merge
'use strict'
const Octokat = require('octokat')
const Promise = require('bluebird')
const ORIGIN_USERNAME = 'username-or-organisation'
const ORIGIN_REPO = 'the-origin-repo'
const ORIGIN_BRANCH = 'master'
const WAIT_FOR_FORK = 5
const WAIT_FOR_MERGE = 5
@timaschew
timaschew / arrays.js
Created April 7, 2016 13:51
JS snippests
// generate a sequence
Array(10).fill().map((_, i) => i + 1)
<?xml version="1.0" encoding="UTF-8"?>
<!--
May-19-2004:
- Changed the <choice> for ElemType_header, moving minOccurs="0" maxOccurs="unbounded" from its elements
to <choice> itself.
- Added <choice> for ElemType_trans-unit to allow "any order" for <context-group>, <count-group>, <prop-group>, <note>, and
<alt-trans>.