Skip to content

Instantly share code, notes, and snippets.

= (λx.x x)(λx.x x)

Nathan Lilienthal nixpulvis

= (λx.x x)(λx.x x)
Block or report user

Report or block nixpulvis

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
nixpulvis / contract.rkt
Last active Aug 29, 2015
Simplest Contract System
View contract.rkt
#lang racket
;; A Contract is one of:
;; - Any -> Boolean
;; - Signature
;; A Signature is a (signature Contract Contract)
(struct signature (domain range))
nixpulvis / contract.rb
Created Apr 4, 2015
Simplest Contract System in Ruby
View contract.rb
# A Contract is one of:
# - Proc (Any -> Boolean)
# - Hash { Contract => Contract }
def assert_predicate(predicate, value)
if predicate.(value)
fail "contract error"
nixpulvis / clone.rb
Created Jun 13, 2015
Clone/Pull All Repositories From GitHub
View clone.rb
#!/usr/bin/env ruby
require 'pry'
require 'json'
json = JSON.parse(`curl`)
json.each do |repo|
if File.exists?(repo['name'])
print "Pulling #{repo['name']}... "
View hello_world.s
.global _start
movl $foo,%edx
movl $string,%ecx
movl $1,%ebx
movl $4,%eax
int $0x80
movl $0,%ebx
nixpulvis /
Last active Sep 17, 2015
Try or Rust macro, for more generally treating Results as values.
macro_rules! try_or {
($expr:expr => $handler:expr) => (match $expr {
::std::result::Result::Ok(v) => v,
::std::result::Result::Err(e) => {
warn!("{}", e);
nixpulvis /
Created Jan 30, 2012
infinate set (countability of rational numbers)
abstract class ATree {
Rational value;
ATree(Rational value){
this.value = value;
abstract Node expandOneLevel();
// returns the integer value of the node/leaf
public Double doubleValue(){
return this.value.toDouble();
nixpulvis / gist:1926289
Created Feb 27, 2012
Simple Ciclic Data
View gist:1926289
import tester.Tester;
class Star {
String name;
Movie movie;
Star(String name){ = name;
Star(String name, Movie movie){ = name;
nixpulvis / Hex -> Color
Created May 17, 2012
This if a function to convert hex strings into r, g, b color. This function returns multiple variables.
View Hex -> Color
-- converts hex colors to 0-1 colors for use in World of Warcraft.
function V.HexToColor(hex)
local color = { }
if strlen(hex) == 6 or strlength(hex) == 8 then
for i = 1, 8, 2 do
if strsub(hex, i, i+1) == "" then print(strsub(hex, i, i+1)) break end
-- converting string to number 0-1
tinsert(color, tonumber(strsub(hex, i, i+1), 16)/255)
nixpulvis / gist:2779607
Created May 24, 2012
repositioning from child
View gist:2779607
mover:SetScript("OnDragStart", function()
local lastX, lastY = GetCursorPosition()
mover:SetScript("OnUpdate", function()
local x, y = GetCursorPosition()
xOff, yOff = x-lastX, y-lastY
lastX, lastY = x, y
for i = 1, frame:GetNumPoints() do
local point, relativeTo, relativePoint, xOffset, yOffset = frame:GetPoint(i)
nixpulvis / gist:2890564
Created Jun 7, 2012
Dynamic content require (for interpreted languages)
View gist:2890564
# returns an array of files that are required by the given file
def get_requirements( file )
requirements =
File.readlines("#{file}.rb").each do |line|
regex = /(?<=require.')(.*)(?=';)/ # matches the requirements in a file
requirement = line.match(regex)
if requirement
requirements << requirement.to_s
You can’t perform that action at this time.