Skip to content

Instantly share code, notes, and snippets.

View vitaly-t's full-sized avatar
🐈
Meow!

Vitaly Tomilov vitaly-t

🐈
Meow!
View GitHub Profile
@vitaly-t
vitaly-t / angular.js
Last active December 28, 2015 16:09
AngularJS 1.5 RC-0, decommented with https://github.com/vitaly-t/decomment
(function(window, document, undefined) {'use strict';
function minErr(module, ErrorConstructor) {
ErrorConstructor = ErrorConstructor || Error;
return function() {
var SKIP_INDEXES = 2;
var templateArgs = arguments,
code = templateArgs[0],
message = '[' + (module ? module + ':' : '') + code + '] ',
@vitaly-t
vitaly-t / gist:cdbf92232cff320041e31f6c98ec5035
Created November 11, 2018 07:01
IIS config for Angular
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="angularjs routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
import {Subject} from 'rxjs';
interface CountedSubscription {
unsubscribe: () => void
}
export type CountParams = {
newCount: number,
prevCount: number
};
@vitaly-t
vitaly-t / observable.ts
Created May 29, 2019 04:47
Simpler observable, with subscriptions monitoring
export class Subscription {
private unsub: () => void;
constructor(unsub: () => void) {
this.unsub = unsub;
}
public unsubscribe(): void {
if (this.unsub) {
this.unsub();
function stringify(value) {
if (value !== undefined) {
return JSON.stringify(value, (_, v) => typeof v === 'bigint' ? v.toString() : v);
}
}
function stringify(value) {
if (value !== undefined) {
return JSON.stringify(value, (_, v) => typeof v === 'bigint' ? v.toString() : v);
}
}
function stringify(value) {
if (value !== undefined) {
return JSON.stringify(value, (_, v) => typeof v === 'bigint' ? v.toString() : v);
}
}
function stringify(value) {
if (value !== undefined) {
return JSON.stringify(value, (_, v) => typeof v === 'bigint' ? v.toString() : v);
}
}
// Works the same as JSON.stringify,
// but also handles BigInt type:
function stringify(value) {
if (value !== undefined) {
return JSON.stringify(value, (_, v) => typeof v === 'bigint' ? v.toString() : v);
}
}
// Works the same as JSON.stringify, but also handles BigInt type,
// using 123n format, to make sure the result is reversible:
function stringify(value) {
if (value !== undefined) {
return JSON.stringify(value, (_, v) => typeof v === 'bigint' ? `${v}n` : v);
}
}