Skip to content

Instantly share code, notes, and snippets.

@pradeep90
pradeep90 / sample_with_dash_arrow.py
Created December 15, 2021 19:43
Compare Callable types with `->` vs `=>`
# These are some function signatures that have use Callable types.
# I sampled these at random from typeshed.
# I have preserved the formatting. If typeshed split the parameters on
# different lines, I did the same. If it kept them on the same line, I did so
# as well. That gives us a more realistic picture of how readers will see
# these signatures in the wild.
# These use the dash-arrow: `->`.
# I've listed simple examples first and the less-readable examples towards the end.
@pradeep90
pradeep90 / sized_list.py
Created September 23, 2020 12:43
Example SizedList type in Pyre
from typing import *
from typing_extensions import Literal
from pyre_extensions import Add
T = TypeVar("T")
N = TypeVar("N", bound=int)
M = TypeVar("M", bound=int)
class SizedList(Generic[T, N]): ...
;;; wc-mode.el --- show wc-like information in status bar
;; Copyright (C) 2011-2012 Toby Cubitt
;; Author: Toby Cubitt <toby-predictive@dr-qubit.org>
;; Version: 0.1
;; Keywords: length, characters, words, lines, mode line
;; URL: http://www.dr-qubit.org/emacs.php
@pradeep90
pradeep90 / real-mini-load_004.php
Created November 30, 2013 06:09
The script that causes parallel selector matching to crash. Note: it says php but it is actually JS code.
(
function (window, undefined) {
var rootjQuery, readyList, document = window.document,
location = window.location,
navigator = window.navigator,
_jQuery = window.jQuery,
_$ = window.$,
core_push = Array.prototype.push,
core_slice = Array.prototype.slice,
core_indexOf = Array.prototype.indexOf,
@pradeep90
pradeep90 / core-dump.txt
Created November 14, 2013 06:35
The core dump I get with Servo for simple-bigcss.html (which uses simple-css.css)
*** Error in `./servo': double free or corruption (out): 0x00007f6964c17130 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80a46)[0x7f696fe60a46]
/usr/local/lib/libfontconfig.so.1(+0x1afc6)[0x7f696e3d7fc6]
/usr/local/lib/libfontconfig.so.1(FcPatternDestroy+0x82)[0x7f696e3d81b2]
/home/spradeep/Code/servo/build/x86_64-unknown-linux-gnu/src/components/gfx/libgfx-36729de4843bf62b-0.1.so(_ZN8platform5linux9font_list20path_from_identifier18h2236382d7151eebaa4v0.1E+0x4e3)[0x7f6971930b93]
/home/spradeep/Code/servo/build/x86_64-unknown-linux-gnu/src/components/gfx/libgfx-36729de4843bf62b-0.1.so(_ZN8platform5linux12font_context42FontContextHandleMethods
$FontContextHandle27create_font_from_identifier20hd177d8b3920374aWmai4v0.1E+0xc3)[0x7f69719277f3]
@pradeep90
pradeep90 / Explorer.java
Last active December 16, 2015 20:28
My solution for the Explorer problem. To compile: javac Explorer.java To run: java Explorer < test-file.txt
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
class User {