Skip to content

Instantly share code, notes, and snippets.

Aseem Kishore aseemk

Block or report user

Report or block aseemk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aseemk
aseemk / package.json
Last active Aug 21, 2017
FiftyThree Mix (AKA Paper Public Stream) archiver/scraper script
View package.json
{
"name": "mix-archiver",
"version": "1.0.0",
"description": "Scrape and archive a FiftyThree Mix (Paper Public Stream) profile.",
"bin": "scrape.js",
"author": "Aseem Kishore <aseem.kishore@gmail.com>",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"superagent": "^3.6.0"
@aseemk
aseemk / typescript-static-and-runtime-typing.ts
Last active Nov 13, 2016
An example of how to use TypeScript's impressive type inference with both generics and function overloads to achieve robust static typing with runtime type knowledge too! Playground: http://tinyurl.com/hxue2sw
View typescript-static-and-runtime-typing.ts
type StaticValueType = string | number | boolean;
type StringValueType = 'string' | 'number' | 'boolean';
function parse(val: string): 'string';
function parse(val: number): 'number';
function parse(val: boolean): 'boolean';
function parse<T extends StringValueType>(val: null, valType: T): T;
function parse(val: StaticValueType | null, valType?: StringValueType): StringValueType {
if (val == null) {
if (valType == null) {
@aseemk
aseemk / 1-trello-sum-bookmarklet.md
Last active Nov 15, 2017
Trello bookmarklet to (re-)calculate sums of "points" from cards.
View 1-trello-sum-bookmarklet.md

Trello bookmarklet to (re-)calculate sums of "points" from cards.

"Points" can be anything numeric (no units). Just prefix each card you want to count with the points in parentheses. E.g. (3) Investigate options.

It's okay for cards to not have points. They just won't be included in the sums.

The sum of points for each list will get added to the list title in the same way as cards. E.g. (17) To Do. Any existing sum will get updated.

The list's actual title (e.g. if you refresh) will not be updated; only the "display" title at that moment will be.

@aseemk
aseemk / 1-instructions.md
Last active Nov 27, 2016
Bookmarklet template!
View 1-instructions.md

TODO: Add description of your bookmarklet here.

To add this bookmarklet to your browser, instructions for Chrome:

  1. Right-click your Bookmarks Bar.
  2. Click "Add Page..."
  3. For "Name", type "TODO: Title here".
  4. For "URL", copy-paste the below:
View neo4j-transaction-test._coffee
echo = console.log
Request = require 'request'
BASE_URL = 'http://localhost:7474'
# helper to make transactional requests:
req = (_, {query, params, commit, rollback, txId}) ->
method = if rollback then 'DELETE' else 'POST'
url = "#{BASE_URL}/db/data/transaction"
@aseemk
aseemk / async-loading.md
Last active Aug 29, 2015
CoffeeScript + Streamline patterns for async loading + caching.
View async-loading.md

Pattern 1: Pre-fetch the result, and cache it.

The result will hopefully already be available when needed, and the async call will be made only once.

fooFuture = fetchFoo !_

# anytime when needed:
foo = fooFuture _   # supports multiple calls!
@aseemk
aseemk / keybase.md
Created Mar 22, 2014
Keybase verification!
View keybase.md

Keybase proof

I hereby claim:

  • I am aseemk on github.
  • I am aseemk (https://keybase.io/aseemk) on keybase.
  • I have a public key whose fingerprint is 8FD7 03E6 42A7 B1CD 6D50 07F4 4929 0166 F879 0B95

To claim this, I am signing this object:

@aseemk
aseemk / coffeescript-updates.md
Last active Dec 2, 2017
CoffeeScript upcoming changes.
View coffeescript-updates.md

CoffeeScript 1.7 is shaping up to be a pretty kick-ass release with significant improvements. Here are the ones I'm most excited about, in order of my own excitement.

Parentheses-free chaining

https://github.com/jashkenas/coffee-script/pull/3263

Years of being wished for, finally granted!

@aseemk
aseemk / neo4j-cypher-weighted-followers.md
Last active Dec 31, 2015
Neo4j Cypher query to get a "normalized" or "weighted" follower count in a social graph.
View neo4j-cypher-weighted-followers.md

This is a Neo4j 1.9 (pre-2.0) query:

START user=node:nodes(type='user')
MATCH user <-[:follows]- follower -[?:follows]-> other
WITH user, follower, 1.0 / COUNT(other) AS weighted
WITH user, COUNT(follower) AS numFollowers, SUM(weighted) as totalWeighted
RETURN user, numFollowers,
  ROUND(totalWeighted * 100) / 100.0 AS totalWeighted,
  ROUND(totalWeighted * 100 / numFollowers) / 100.0 AS avgFollowerWeight
@aseemk
aseemk / streamline-guide.md
Last active Dec 30, 2015
An excerpt of our internal Node.js style guide at @FiftyThree, talking about Streamline patterns, tips, and tricks. Tailored for CoffeeScript.
View streamline-guide.md
You can’t perform that action at this time.