Skip to content

Instantly share code, notes, and snippets.

@soroushjp
soroushjp / tsconfig.json
Created April 20, 2019 03:02
Sane default tsconfig
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"sourceMap": true, /* Generates corresponding '.map' file. */
"outDir": "build", /* Redirect output structure to the directory. */
/* Strict Type-Checking Options */
@soroushjp
soroushjp / deepcopy.go
Last active February 7, 2024 09:42
Golang: deepcopy map[string]interface{}. Could be used for any other Go type with minor modifications.
// Package deepcopy provides a function for deep copying map[string]interface{}
// values. Inspired by the StackOverflow answer at:
// http://stackoverflow.com/a/28579297/1366283
//
// Uses the golang.org/pkg/encoding/gob package to do this and therefore has the
// same caveats.
// See: https://blog.golang.org/gobs-of-data
// See: https://golang.org/pkg/encoding/gob/
package deepcopy
@soroushjp
soroushjp / mergesort.go
Last active August 29, 2015 14:16
Short, readable, recursive implementation of Mergesort in Golang using slices
// Mergesort
package main
import "fmt"
func Push(front int, rest []int) []int {
new := make([]int, len(rest)+1)
copy(new[1:], rest)
new[0] = front
@soroushjp
soroushjp / string_concat.go
Created January 27, 2015 14:20
Go Benchmarking example for string concatenation. Use with `go test -bench=.`
package string_concat
import (
"bytes"
)
func ConcatOperator(original *string, concat string) {
// This could be written as 'return *original + concat' but wanted to confirm no special
// compiler optimizations existed for concatenating a string to itself.
*original = *original + concat
@soroushjp
soroushjp / name.md
Created July 29, 2014 21:24
OneName.io Identity Verification

OneName.io Identity Verification

@soroushjp
soroushjp / app.js
Created August 1, 2012 13:33 — forked from pgte/app.js
Node Tuts episode 9 - Express
var express = require('express');
var app = express.createServer();
app.configure('development', function () {
app.use(express.logger());
app.use(express.errorHandler({
dumpExceptions: true,
showStack: true
}));