Skip to content

Instantly share code, notes, and snippets.

View tamouse's full-sized avatar
🏠
Working from home

Tamara Temple tamouse

🏠
Working from home
View GitHub Profile
@tamouse
tamouse / MOVED.md
Last active August 29, 2015 14:08
My Rails Application Template

This has been moved to a regular Github repo:

/*
Basic Usage
===========
Assuming your markup looks like this:
<table id="table" class="table"></table>
<div id="pagination" class="text-center"></div>
@matheusoliveira
matheusoliveira / json_manipulator.sql
Last active February 17, 2024 15:14
Simple PostgreSQL functions to manipulate json objects. (Note: performance is not a concern for those functions)
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)
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)
@rklemme
rklemme / pipes.rb
Last active September 9, 2016 14:14
Execute multiple commands connected through pipes either via threads or processes.
#!/usr/bin/ruby -w
if ENV['DEBUG']
def debug(message)
$stderr.puts message
end
else
def debug(message)
# nop
end