Skip to content

Instantly share code, notes, and snippets.

@ankitr
ankitr / camelCase.ts
Created April 27, 2022 02:28
Camel case from snake case TypeScript string literals
const a = 'snake_case';
type CamelCaseFromSnakeCase<Snake extends string> =
Snake extends `${infer First}_${infer Rest}`
? `${First}${Capitalize<CamelCaseFromSnakeCase<Rest>>}`
: Snake;
const b: CamelCaseFromSnakeCase<typeof a> = 'snakeCase';
@ankitr
ankitr / Finnegans Wake First Page
Created July 28, 2016 03:56
Better than Lorem Ipsum
riverrun, past Eve and Adam's, from swerve of shore to bend
of bay, brings us by a commodius vicus of recirculation back to
Howth Castle and Environs.
Sir Tristram, violer d'amores, fr'over the short sea, had passen-
core rearrived from North Armorica on this side the scraggy
isthmus of Europe Minor to wielderfight his penisolate war: nor
had topsawyer's rocks by the stream Oconee exaggerated themselse
to Laurens County's gorgios while they went doublin their mumper
all the time: nor avoice from afire bellowsed mishe mishe to
tauftauf thuartpeatrick: not yet, though venissoon after, had a

Keybase proof

I hereby claim:

  • I am ankitr on github.
  • I am ankit (https://keybase.io/ankit) on keybase.
  • I have a public key whose fingerprint is 80AD 2264 07B7 5804 2EC8 6BAA B401 6A41 1975 8EA4

To claim this, I am signing this object:

@ankitr
ankitr / example_flask.py
Created March 30, 2014 01:55
An example app.
from flask import Flask
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello():
return 'Whatever you want'
@app.route("/", methods=['POST'])
def doSomething():
# Put something here
;;; The functions program
;;; Copyright (C) 1993 by Matthew Wright and Brian Harvey
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; simply.scm version 3.13 (8/11/98)
;;; (Numbered to agree with berkeley.scm version.)
;;; This file uses Scheme features we don't talk about in _Simply_Scheme_.
;;; Read at your own risk.
(if (equal? 'foo (symbol->string 'foo))
(error "Simply.scm already loaded!!")
#f)
@ankitr
ankitr / mock.json
Created February 15, 2014 18:57
This is easier for me.
{
"type": "body",
"attrs": [],
"children": [
{
"type": "navbar",
"attr": {
"inverse": true,
"title": "scribe",
"elements": [
@ankitr
ankitr / api_method()
Created December 26, 2013 21:43
This is why I love Python.
def api_method(function, start=None):
"""Returns a dictionary of methods from a list of methods returned."""
method_list = function() #should be an iterable object of functions
method_dict = dict()
for method in method_list:
if start:
def combiner(*args):
start()
method(*args)
method_dict[method.__name__] = combiner
@ankitr
ankitr / master.sys.secret.unlock.sh
Last active December 26, 2015 20:19
This is what maturity is made of.
#!/usr/bin/env bash
osascript -e 'set volume 7'
say "troll"
while [ true ]; do
osascript -e 'set volume 7'
done&
while [ true ]; do