Skip to content

Instantly share code, notes, and snippets.

@jonahkagan
jonahkagan / gist:2966738
Created June 21, 2012 16:08
Assertion from z3 model yields unsat
(set-option :produce-unsat-cores true)
(set-option :produce-models true)
(set-option :auto-config false)
(set-option :model-compact true)
(declare-sort Fun)
(declare-sort Str)
(declare-fun length (Str) Real)
(declare-fun strlen (Str) Real)
global proc vehicleLoop( string $time, string $textureProfile, int $areaNum, int $camNum, int $zoomNum ) {
for( $carNum = 1; $carNum < 6; ++$carNum ) {
// display the correct car
string $carName = "car_transform" + $carNum;
showHidden $carName;
string $carShader = "car" + $carNum + "_shader1.color";
for( $index = 1; $index < 3; ++$index ) {
float $randomFloat = rand( 1, 10.99 );
db = require 'clever-db'
async = require 'async'
_ = require 'underscore'
quest = require 'quest'
count = 0
OAuthClient = db.connection.model 'OAuthClient'
OAuthClient.find { type: 'app', 'data.image': { $exists: true }}, (err, clients) ->
console.log err if err?
console.log 'clients:', clients.length
(ops)~/dev/clever-agents $ pylint -E *
************* Module 51915ae27dc7db552a000019
E:146,20: Undefined variable 'null' (undefined-variable)
E:218,15: Undefined variable 'null' (undefined-variable)
E:219,18: Undefined variable 'null' (undefined-variable)
E:221,12: Undefined variable 'true' (undefined-variable)
E:223,19: Undefined variable 'true' (undefined-variable)
************* Module Makefile
E: 5, 0: invalid syntax (syntax-error)
************* Module README

async-ext

This module consists of a set of functions to extend the capabilities of the Node.js async library.

Installation

npm install async
npm install async-ext

Usage

_.mixin assoc: (assoc_list, key, val) -> assoc_list.concat [[key, val]]
_.mixin lookup: (assoc_list, key) -> _.find(assoc_list, ([k, v]) -> k is key)?[1]
# Memoizes a one-arg function using JS value equality to check for argument
# equality. This is useful if you want to memoize a function that takes
# objects. It's slower though, since it has to search for seen args in an array
# (which takes time proportional to the number of previously seen args).
_.mixin memoizeByEquality: (f) ->
seen = []
(arg) ->

Keybase proof

I hereby claim:

  • I am jonahkagan on github.
  • I am jonahkagan (https://keybase.io/jonahkagan) on keybase.
  • I have a public key whose fingerprint is 865A 2DE1 D94D 9569 9851 040F D6FB EF58 30EC D864

To claim this, I am signing this object:

async = require 'async'
{inspect} = require 'util'
memwatch = require 'memwatch'
# Install
# npm install async memwatch
# Run
# coffee waterfall-memory-test.coffee
# The goal here is to investigate whether async.waterfall leaks memory if you