Skip to content

Instantly share code, notes, and snippets.

View RJ's full-sized avatar
🥱
parenting toddlers

Richard Jones RJ

🥱
parenting toddlers
View GitHub Profile
<?php
function array_map_eval($code, $array)
{
$retval=array();
foreach($array as $_) $retval[]=eval($code);
return $retval;
}
$input = array();
for($i=0;$i<2;++$i)
% An ad hoc, informally-specified, bug-ridden, slow implementation of half of Lisp
%
% start like: erlc erlisp.erl && rlwrap erl -noshell -s erlisp -s init stop
% quoting and eval are not working.
% one example that works:
% (set triple (lambda (n) (* n 3)))
% (triple 3)
%
% Any feedback on what I'm doing wrong or how to improve appreciated.
% twitter.com/metabrew
#!/bin/bash
# Hacky 'IRCCat for twitter' (see http://github.com/RJ/irccat)
# Usage: ./twittercat.sh
# echo "my tweet" | nc -q0 localhost 9999
PORT=9999
USERNAME="your_twitter_name"
PASSWORD="your_twitter_password"
while [ 1 ]
Music library, search engine and scanner.
Implements the JSON-RPC musiclibrary protocol as outlined below.
NB: "id" field would be unique to each call (increment int, or use guid)
ADDING/REMOVING TRACKS FROM THE INDEX
-------------------------------------
>>> (no "id", thus no response sent)
{
#!/usr/bin/ruby
require 'net/http'
require 'net/https'
require 'uri'
require 'rubygems'
require 'json'
require 'ruby-growl'
require "getopt/long"
opt = Getopt::Long.getopts(
%%
%% Simple pool for gen_servers that only use :call
%%
-module(gen_server_call_pool).
-behaviour(gen_server).
%% --------------------------------------------------------------------
%% External exports
-export([start_link/3, stats/1]).
% Check some stuff, write the .rel file, generate boot scripts and relup, make tar
-module(release_helper).
-export([go/1]).
-define(RELAPPS, [ kernel,
stdlib,
sasl,
crypto,
ssl,
inets,
@RJ
RJ / irccloud_faq.txt
Created October 17, 2010 19:13
Rough cut of FAQ for IRCCloud.com
* Which browsers does it work in?
** We've tested in modern versions of Firefox, Chrome and Safari. It currently doesn't work in IE.
We plan to improve browser support in future.
* Does IRCCloud act as a BNC/bouncer and stay connected when I go offline?
** Yes it does - you will stay connected to IRC even if you shutdown your computer or log out of IRCCloud.com
This means when you come back, you'll be able to see what happened on IRC whilst you were away.
* What will it cost?
** Free currently, will roll out monthly subscription as the beta progresses.
@RJ
RJ / gen_server_call_pool.erl
Created February 18, 2011 16:21
gen_server:call balancer
%%
%% Simple pool for gen_servers that only use :call
%% @author RJ <rj@metabrew.com>
%%
-module(gen_server_call_pool).
-behaviour(gen_server).
-include("irc.hrl").
%% --------------------------------------------------------------------
-module(utf8test).¬
-compile(export_all).¬
¬
¬
b2l(B) when is_binary(B) ->¬
lists:reverse(b2l(B,[])).¬
¬
¬
b2l(<<>>, Acc) -> Acc;¬
b2l(<<Char/utf8,Rest/binary>>, Acc) ->¬