Skip to content

Instantly share code, notes, and snippets.

@need12648430
need12648430 / name.js
Last active Mar 9, 2019
Pronounceable Seeded Name Generator
View name.js
function name (id, l) {
function n(){return id=(399*id)%509}
var r="BDGKNPTVZ"[n()%9]
for (var i=1;i<l;i++) r+=i%2?"aeiou"[n()%5]:"bdgknptvz"[n()%9]
return r
};
// id=seed, l=length
function name (id, l) {
// lcg prng
View send_sms_get_example.php
<?php
// just for the record
$phone_ip = "10.0.0.2";
$phone_port = 8080;
$phone_page = "/send";
// to be clear, this is set in the app preferences
// you can turn off password protection, but i wouldn't suggest it
$tinysmsgate_password = "password";
@need12648430
need12648430 / PokéPie
Created Aug 30, 2014
PokéPieChart, now with 200% more comments
View PokéPie
import java.util.Map;
import java.util.Comparator;
import java.util.Collections;
int index = 0;
// sprite sheet
PImage pokemon;
// current pokemon sprite
PImage current;
// current pie chart
View gist:67c719b8597a837d59fd
import java.util.Map;
import java.util.Comparator;
import java.util.Collections;
int index = 0;
PImage pokemon, current;
PGraphics pie;
HashMap<Integer,Integer> colorMap;
ArrayList<Integer> colorByCount;
@need12648430
need12648430 / gist:0fb5825c4268b988166e
Created Jun 21, 2014
HTTP requests parsed in 4 lines of Lua.
View gist:0fb5825c4268b988166e
local verb, resource, version, headers, body = data:match("(.+)%s+(.+)%s+(HTTP/%d%.?%d?)\r\n(.-)\r\n\r\n(.-)")
headers:gsub("(.-)%s*:%s*(.-)\r\n", function(name, value)
-- do something with name and value here
end)