Skip to content

Instantly share code, notes, and snippets.

View pspi's full-sized avatar

Panu Pitkamaki pspi

View GitHub Profile
@pspi
pspi / analyzequotes.sh
Created January 30, 2020 11:57
Calculate ratio of single quotes to double quotes in .js and .ts files
#!/usr/bin/env bash
# TODO:
# - DRY relevant parts
singlequotes=`find -type f \( -iname \*.js -o -iname \*.ts \) -not -path '*node_modules/*' -exec cat \{\} \; | tr -cd \' | wc -c`
doublequotes=`find -type f \( -iname \*.js -o -iname \*.ts \) -not -path '*node_modules/*' -exec cat \{\} \; | tr -cd '"' | wc -c`
total=$(($singlequotes + $doublequotes))
@pspi
pspi / Gruntfile.js
Last active December 21, 2015 18:49
Using grunt-ts reference file as workaround to typescript command line source file ordering issues
module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-ts");
grunt.initConfig({
ts: {
default: {
src: ["*.ts"],
reference: "reference.ts",
out: 'out.js'
}