Skip to content

Instantly share code, notes, and snippets.

indexr.js

createTable

Indexr introduces a higher-order selector which is dubbed a "table", because it acts a bit like a database table which is able to be "queried" by attribute.

A table is created via createTable, which takes a selector that is expected to return a collection (can either be a map (e.g. if keyed by id) or a list), and indices, a mapping of ways to index that collection.

(translated from jean-luc coudray - lettres d'engueulade)


Dear Sir,

My rearview mirrors informed me of the presence of your buffalo-proof bumper glued against my car, implying that I was going too slowly and that my existence stood in the way of your freedom.

# switch key bind
set -g prefix C-s
unbind C-b
bind C-s send-prefix
set-option -g default-command "reattach-to-user-namespace -l /usr/local/bin/fish"
set -g default-terminal "screen-256color"
set -g default-shell /usr/local/bin/fish
# Status bar
@dingbat
dingbat / .vimrc
Last active November 1, 2017 23:18
vimrc
" begin vim-plug
call plug#begin("~/.vim/plugged")
Plug 'janko-m/vim-test'
Plug 'tpope/vim-rails'
Plug 'mxw/vim-jsx'
Plug 'pangloss/vim-javascript'
Plug 'dag/vim-fish'
@dingbat
dingbat / .tmux.conf
Last active April 1, 2017 23:09
tmux
# switch key bind
set -g prefix C-s
unbind C-b
bind C-s send-prefix
bind C-l send-keys 'C-l'
# set up the colors
set -g default-terminal "screen-256color"
set-option -g default-shell $SHELL
from flask import Flask
from flask import request
from flask.ext.pymongo import PyMongo
from pymongo import MongoClient
app = Flask(__name__)
client = MongoClient('localhost', 27017)
db = client.test_database
@app.route('/post', methods=['POST'])
(define (uncycle lst) (uncycle2 lst lst)) ; recursive handle
(define (uncycle2 lst orig) (if (null? lst)
'() ; means it wasn't actually a cycle, but we forgive
(if (eq? (cdr lst) orig) ; base case. (if the cdr is the list itself)
(list (car lst)) ; return just the element previous
(cons (car lst) ; otherwise, recurse. add the prev element
(uncycle2 (cdr lst) orig))))) ; onto the uncycle'd next part of the list
@dingbat
dingbat / MyConfig.m
Created February 19, 2012 23:01
Example of NSRConfig subclass with parameterization
@interface MyConfig : NSRConfig
@end
@implementation MyConfig
- (NSString *) parameterizeDictionary:(NSDictionary *)dict
{
NSMutableString *parameters = [NSMutableString string];
for (NSString *key in dict)
{
@dingbat
dingbat / rails_error
Created February 2, 2012 20:08
Example of full Rails error message
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Action Controller: Exception caught</title>
<style>
body { background-color: #fff; color: #333; }
body, p, ol, ul, td {
font-family: helvetica, verdana, arial, sans-serif;