This file contains hidden or 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
const express = require('express'); | |
const names = [ | |
'arved', | |
'ahmad', | |
'sebastian', | |
'marcel' | |
]; | |
const randomIndexFromArray = array => { |
This file contains hidden or 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
const parsePagination = s => | |
s | |
.split(',') | |
.map(s => { | |
if(s.match(/^\d+$/)){ | |
return parseInt(s); | |
} | |
if(s.match(/^\d+-\d+$/)){ | |
s = s.split('-'); | |
return Array(s[1] - s[0] + 1) |
This file contains hidden or 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
// jquery.d.ts | |
interface JQuery { | |
toggleClass(name: string, add: boolean): JQuery; | |
} | |
interface JQueryStatic { | |
(...any): JQuery; | |
fn: JQuery; | |
} | |
declare const $: JQueryStatic; |
This file contains hidden or 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
type Color = string; | |
class Player { | |
constructor(public name: string, public color: Color){ } | |
} | |
type Field = Player|null; | |
class GameField { | |
private fields: Field[][]; |
This file contains hidden or 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
abstract class State<T> { | |
abstract id: T; | |
isCurrent: boolean = false; | |
listeners: { [key: string]: Function } = {}; | |
fsm!: StateMachine<T>; | |
on(event: string, cb: Function): void { | |
this.listeners[event] = cb; | |
} | |
trigger(event: string, data?: any): void { | |
if (!this.listeners.hasOwnProperty(event)) { |
This file contains hidden or 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
<?php | |
use Shopware\Bundle\StoreFrontBundle\Service\Core\ContextService; | |
use Shopware\Bundle\StoreFrontBundle\Gateway\DBAL\MediaGateway; | |
use Shopware\Components\Compatibility\LegacyStructConverter; | |
use Enlight_Template_Default; | |
use InvalidArgumentException; | |
/** | |
* @author Sebastian Langer <[email protected]> |
This file contains hidden or 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
<?php | |
/** | |
* @author Sebastian Langer <[email protected]> | |
* @license MIT | |
*/ | |
use Shopware\Bundle\StoreFrontBundle\Service\Core\ContextService; | |
use Shopware\Bundle\StoreFrontBundle\Gateway\DBAL\MediaGateway; | |
use Shopware\Components\Compatibility\LegacyStructConverter; |
This file contains hidden or 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 historyBackWithFallback = function(url){ | |
var originalHref = window.location.href; | |
var timeoutId = setTimeout(function(){ | |
if(window.location.href !== originalHref){ | |
return; | |
} | |
window.location = 'https://google.de'; | |
}, 1500); | |
This file contains hidden or 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
type Extensible<T> = T & { [P in keyof any]: any[P] }; | |
interface IFoo { | |
value: string; | |
} | |
declare const foo: IFoo; | |
foo.value; | |
foo.noError; |
This file contains hidden or 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
const xml2js = require('xml2js'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const fontsXmlPath = process.argv[2]; | |
const fontsFolderPath = path.resolve(fontsXmlPath, '..', 'Fonts'); | |
const tryRename = (filename, psName) => { | |
try { | |
fs.renameSync(path.resolve(fontsFolderPath, filename), path.resolve(fontsFolderPath, psName + path.extname(filename))); |