Skip to content

Instantly share code, notes, and snippets.

@elevine
elevine / react-virtualized.js
Created January 20, 2017 16:55
Jest mock for the react-virtualized AutoSizer component
// __mocks__/react-virtualized.js
// note - at the top of your test file, include this line: jest.mock('react-virtualized');
import React from 'react';
const reactVirtualized = jest.genMockFromModule('react-virtualized');
const autoSizerProps = {
height: 100,
width: 100
}
@elevine
elevine / System Design.md
Created October 21, 2021 17:24 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@elevine
elevine / README.md
Last active July 11, 2019 08:51
Visualizing historical and predicted data with D3.

A graph which depicts historical and predicted data. Predicted data is represented by a dashed line, with a shaded area to indicate the error range.

@elevine
elevine / ListAdapter.java
Created May 3, 2011 23:34
Boilerplate code for creating an Android Adapter which is backed by an in memory List
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/**
* Adapter that is backed by an in memory List.
@elevine
elevine / keybase.md
Created January 25, 2017 14:40
keybase.md

Keybase proof

I hereby claim:

  • I am elevine on github.
  • I am elevine (https://keybase.io/elevine) on keybase.
  • I have a public key whose fingerprint is DCD2 0A60 277B 69D8 3E64 AEA5 4654 D0CC 1229 1B56

To claim this, I am signing this object:

@elevine
elevine / startapp.sh
Last active December 27, 2016 05:44
How to start an Android Activity from adb
adb shell am start -n my.app.package/.path.to.LauncherActivity
adb shell am force-stop my.app.package
@elevine
elevine / index_markercluster.html
Last active September 26, 2016 17:07
Realtime Dyamic Leaflet MarkerCluster
<head>
<style>
#map {
height: 100vh;
width: 100vw;
padding: 0px;
margin: 0px;
background: white;
}
var fs fileSystem = osFS{}
type fileSystem interface {
Open(name string) (file, error)
Stat(name string) (os.FileInfo, error)
}
type file interface {
io.Closer
io.Reader
@elevine
elevine / AES-CTR-256-Example.cs
Created April 14, 2016 20:00 — forked from beveradb/AES-CTR-256-Example.cs
Example AES CTR 256 bit encryption with no IV in C#
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Paddings;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Utilities.Encoders;
using System;
using System.Globalization;
using System.Security.Cryptography;
@elevine
elevine / cb_sync_gateway_logger.js
Created February 18, 2016 20:52
Script to try and record the time it takes for documents to be synced by the Sync Gateway
var WebSocket = require('ws');
var ws = new WebSocket('ws://<server-address>:4984/db/_changes?feed=websocket');
var messageCount = 0;
var totalTime = 0;
var wsOptions = {
include_docs : true,
channels : "test",
filter: "sync_gateway/bychannel",