Skip to content

Instantly share code, notes, and snippets.

@drewrygh
drewrygh / gist:a8c6e87bb805185e3e4c3910dbacb863
Created December 9, 2023 03:00
get the max count of consecutive/duplicative network requests that occur within 1000ms of each other
const fs = require('fs');
const readline = require('readline');
const dataPath = "./Downloads/activities_export_full.jsonl";
const readStream = fs.createReadStream(dataPath);
let requestsByUserId = {};
const rl = readline.createInterface({
@drewrygh
drewrygh / safe-http.ts
Created May 30, 2016 01:33
A HTTP module for Ionic apps that handles 'no network connection' errors in a friendly way.
import {Injectable} from 'angular2/core';
import {Http, Request, Response, RequestOptionsArgs} from 'angular2/http';
import {Alert, NavController} from 'ionic-angular';
import {Network, Connection} from 'ionic-native';
@Injectable()
export class NetworkService {
public networkAlert: any;