This has been moved to a regular Github repo:
#!/usr/bin/ruby -w | |
if ENV['DEBUG'] | |
def debug(message) | |
$stderr.puts message | |
end | |
else | |
def debug(message) | |
# nop | |
end |
cons = ->(x,y){ ->(a){ a.(x,y) } } | |
car = ->(c){ c.(->(x,_){ x }) } | |
cdr = ->(c){ c.(->(_,y){ y }) } | |
pair = cons.(1,2) | |
puts car.(pair) | |
puts cdr.(pair) |
CREATE OR REPLACE FUNCTION public.json_append(data json, insert_data json) | |
RETURNS json | |
IMMUTABLE | |
LANGUAGE sql | |
AS $$ | |
SELECT ('{'||string_agg(to_json(key)||':'||value, ',')||'}')::json | |
FROM ( | |
SELECT * FROM json_each(data) | |
UNION ALL | |
SELECT * FROM json_each(insert_data) |
/* | |
Basic Usage | |
=========== | |
Assuming your markup looks like this: | |
<table id="table" class="table"></table> | |
<div id="pagination" class="text-center"></div> |
TinyVM is a simple register based virtual machine implemented in C (tinyvm.c
). The bytecode assembler is written in Python (tas.py
). TinyVM has 4 registers ($0
- $3
) and 64k of memory in a 32-bit address space (0x00000000
- 0x0000FFFF
).
Each instruction is encoded in a single 64-bit word. Register count and memory are defined at compile time, but due to only having 32 bits available for addressing and 8 bits for registers, allocating more than 4GB of memory or 256 registers is pointless.
The following instructions (loosely based on MIPS) have been implemented:
No. | Keyword | Instruction | Example | Description
-------|---------|-------------------------------|--------------------|------------
-
We have absolutely no idea what we're doing in tech. Please explain the utmost basic things to us.
-
We only do web design. Our whole reason of being in tech is to make things pretty. Consider us the doilies of the industry.
-
We're not laughing about your joke, so we clearly need you explain it to us. In great detail.
-
We're only in tech to find a husband, boyfriend or generally to get laid.
namespace :log do | |
def timestamp line | |
values = line.match(/(\d{4})\-(\d{2})\-(\d{2})T(\d{2})\:(\d{2})\:(\d{2}\.\d{6})/).captures | |
Time.new(*values.map(&:to_f)) | |
end | |
task :timestamps do | |
Dir.glob(File.join(log_path, '*.log')).each do |fn| | |
top = `head -n 2 #{fn}`.split("\n") | |
top.shift if top[0] =~ /Logfile created/ |