Skip to content

Instantly share code, notes, and snippets.

@bibby
bibby / jq_inputkey_selector.js
Created January 2, 2011 22:08
jquery input "array key" selector
/*
The past few days, I've seen people in #jquery asking about using selectors
to match inputs with names that would produce arrays on the backend, such as
<input name="foo[]" />
<input name="foo[foo]" />
<input name="foo[bar][baz]" />
So I wrote a selector that works with these.
Feel free to use/improve
@bibby
bibby / gardner.erl
Created July 28, 2013 06:28
A solution to finding the smallest integer with a multiplicative persistence of 5 (to 9) for Erlang
% A solution to a puzzle in Martin Gardner's book
% The Colossal Book of Short Puzzles and Problems,
%
% bibby <bibby@bbby.org>
%
% Puzzle:
% A number's persistence is the number of steps required
% to reduce it to a single digit by multiplying all its
% digits to obtain a second number, then multiplying all
% the digits of that number to obtain a third number, and
@bibby
bibby / dropplets-plugins.md
Created October 11, 2013 00:57
dropplets plugin plans

Dropplet plugin plans

Life cycle events

These events occur naturally during the life of a post. Sometimes once, others frequently. The intention is to provide hooks in an event-broadcast style that allow users to intercept them and introduce plugin code between normal operations.

Events being looked at:

  • post add
@bibby
bibby / dropplets-dip.png
Last active December 25, 2015 06:59
dropplets dependency inversion
dropplets-dip.png
@bibby
bibby / dropplets-oop.png
Last active December 25, 2015 08:29
dropplets oop plan
dropplets-oop.png
@bibby
bibby / rpc.gd
Created February 22, 2014 07:50
Godot HTTPClient usage
## rpc.gd
# An experiment in using HTTPClient
# for blocking RPCs
# @author bibby<bibby@bbby.org>
#
# get( url )
# post( url, body )
# put( url, body )
# delete( url )
@bibby
bibby / panel.gd
Created March 12, 2014 14:59
gd sockets.. y u no write?
extends Panel
export(String) var host = "localhost"
export(int) var port = 7777
export(bool) var autoConnect = true
var Socket = preload("socket.gd")
var socket
func _init():
#!/usr/bin/python
import os
from StringIO import StringIO
from ConfigParser import ConfigParser, NoOptionError
DOCUMENTATION = '''
---
module: directadmincfg
short_description: Sets options to a direct admin options conf
@bibby
bibby / ass-to-txt.py
Created January 25, 2017 06:44
ass UTF-16 subfile to UTF-8 plain text
# rfw/python-ass does the heavy lifting,
# but I needed to hack around UTF-16 encoded files,
# saving them back as UTF-8
import ass
import re
import sys
in_file = sys.argv[1]
out_file = re.sub('[as]+$', 'txt', in_file)
@bibby
bibby / renderer.js
Created March 20, 2017 17:51
skip expansion of numbers
var Marked = require('marked')
var cryptoz = require('crypto')
var Nsh = require('node-syntaxhighlighter')
var namer = require('./namer')
var Page = require('./models').Page
var directives = require('./directives')
var Configurable = require('./configurable')
var Configuration = function () {
Configurable.call(this)