Skip to content

Instantly share code, notes, and snippets.


Bold is me. Everything else is the AI. This is from AI Dungeon with the Dragon model in Story mode.

You are talking to GPT-2, an AI designed to write Javascript. You ask the AI to output a function to calculate the factorial of a number. It outputs:

function factorial(n) { return n * (1 + x^n); }

You say: "No, that's not right. You should use a loop."

erose / crash-the-haskell-typechecker.hs
Created Dec 9, 2019
The simplest way I know of to crash/hang the Haskell typechecker using UndecidableInstances.
View crash-the-haskell-typechecker.hs
-- Inspired by and
-- See the latter for a well-paced
-- introduction to what's going on in general.
-- Allows one type parameter to a class to be fully determined by the type of another.
{-# LANGUAGE FunctionalDependencies #-}
-- The head of an instance declaration may mention arbitrary nested types.
{-# LANGUAGE FlexibleInstances #-}
erose /
Last active Oct 29, 2019
Recurse Center application code -- symbolic differentiation
from typing import *
import sys
import re
def differentiate(expression: List[str], with_respect_to: str) -> List[str]:
# We do the differentiation in one pass, then simplify the result.
first_pass = [_differentiate_single_term(t, with_respect_to) for t in expression]
simplified = _simplify_expression(first_pass)
return simplified
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
items: [
{time: moment()},
{time: moment().subtract(1, 'day')},
sortProperties: ['time'],
sortedItems: Ember.computed.sort('items', 'sortProperties'),
erose / adapters.application.js
Created May 10, 2017
ObjectProxy DS.HasMany
View adapters.application.js
import Adapter from "ember-data/adapters/json-api";
export default Adapter.extend();
erose / decrypt_cookie.rb
Created Apr 24, 2017
Decrypt a Rails 5 session cookie
View decrypt_cookie.rb
You can’t perform that action at this time.