Skip to content

Instantly share code, notes, and snippets.

@ovrmrw
ovrmrw / mp3-rename-util.ts
Created April 18, 2017 07:03
Re-name MP3 files from its ID3 tag's title.
import * as fs from 'fs-extra'
import * as nodeID3 from 'node-id3'
import * as path from 'path'
const TARGET = 'au_kaiwa_1705_A'
const filePaths = fs.readdirSync(TARGET)
.map((file) => path.join(process.cwd(), TARGET, file))
.filter((filePath) => fs.existsSync(filePath))
import { WindowWrapper } from './WindowWrapper';
let _namespace: Namespace | undefined;
export class Namespace {
private readonly key: string;
static fromName(key: string): Namespace {
if (!_namespace) {
_namespace = new Namespace(key);
@ovrmrw
ovrmrw / setup-ionic-jest-boilerplate.js
Last active March 4, 2018 14:24
Create files for Jest testing for Ionic project
const fs = require('fs');
const path = require('path');
const root = path.resolve();
// Create jest.config.js
const jestConfigJS = `module.exports = {
preset: 'jest-preset-angular',
roots: ['src'],
testRegex: '\\\\.spec\\\\.ts$',
@ovrmrw
ovrmrw / swaggerYamlToTypeScriptInterfaces.ts
Created March 23, 2018 02:24
Generate TypeScript interfaces from swagger.yaml
import * as jsyaml from 'js-yaml';
import * as path from 'path';
import * as fs from 'fs';
interface PropertyStructure {
required: string[];
properties: Record<string, { type: string }>;
}
class Definition {
type ParamValue = string | number | boolean;
export interface ParamsObject {
[key: string]: ParamValue | ParamValue[];
}
export class RouterWrapper {
private _location: Location;
private _URL: typeof URL;