Skip to content

Instantly share code, notes, and snippets.

Jason Orendorff jorendorff

  • Nashville, TN
Block or report user

Report or block jorendorff

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
View Vec.dfy
// Vec.dfy - A sketch of Rust's Vec<T> in Dafny, proving the unsafe operations safe
//
// ### Background
//
// Rust is a systems programming language. `Vec<T>` is the basic growable array
// type in Rust. It's implemented in Rust, using unsafe code; some parts are
// implemented by an underlying `RawVec<T>` type, also using unsafe code.
//
// Dafny is a C#-like programming language with proofs. In Dafny, assertions
// are checked at compile time! If the compiler can't prove that the assertion
View RawVec.dfy
module Util {
type usize = nat
type Ptr = nat
function null_ptr(): Ptr { 0 }
predicate is_null(p: Ptr) { p == 0 }
datatype Option<T> = None | Some(value: T)
function range(start: nat, stop: nat): seq<nat>
View simple_expr_parser_tables.py
import pgen_runtime
from pgen_runtime import Apply
actions = [
# 0. <empty>
{'-': 1, 'NUM': 2, 'VAR': 3, '(': 4},
# 1. "-"
{'-': 1, 'NUM': 2, 'VAR': 3, '(': 4},
View bad.txt
$ hg log -r tip
changeset: 539025:519828d4a0a5
tag: tip
parent: 538768:93075ec49df3
user: Jason Orendorff <jorendorff@mozilla.com>
date: Tue Apr 09 13:11:27 2019 -0500
summary: Bug 1539821 - Part 1: Delete ModifierException::NoneIsOperand. r?jwalden
================================================================================ 2019-04-09 13:11:34
View pratt.dfy
// *** Basics *****************************************************************
// A nonzero number's divisors are the numbers that divide it evenly.
//
// Also called "factors". The divisors of 12 are 1, 2, 3, 4, 6, and 12.
function divisors(k: nat): set<nat>
requires k > 0
{
set n: int | 0 < n <= k && k % n == 0
}
View t90.js
try {
var P60 = 2;
while (P60 !== 1) {
switch (P60) {
case 2:
(function t90() {
var X60 = 2;
while (X60 !== 5) {
switch (X60) {
case 2:
View decorators-v3-feedback.md

Feedback on static ("v3") decorators

Please thank littledan and the other champions for (in short) doing everything right.

I'm convinced static ("v3") decorators are not the way forward.

I think the concrete disadvantages of a static design should be taken more into account:

View log.md

Here's one of the ORIGINALRANGE changesets:

$ hg log --graph --hidden -r 0262c62d81e5
x  changeset:   528466:0262c62d81e5
~  parent:      528452:47e514e01c5c
   user:        Jason Orendorff <jorendorff@mozilla.com>
   date:        Thu Feb 21 09:51:45 2019 -0600
   obsolete:    rewritten using prune as 528566:e7fd0ec90ddf
   obsolete:    rewritten using pick as 528814:b3cce8cc8cf8
View any_string.py
import random
class IndexedList:
""" Like a list, but append-only, values must be hashable, and duplicates are ignored. """
def __init__(self, values=None):
self._list = []
self._index = {}
if values is not None:
for v in values:
View gist:06363f3c08b9157b09030a3fc93440f1

ICYMI: New JavaScript Language Features

Let's talk about JavaScript.

Here are five new language features that are available in Firefox Nightly. These are new things that weren't there the last time we did this.

I'm going to move quickly, because although the things are small, there are several of them.

You can’t perform that action at this time.