Skip to content

Instantly share code, notes, and snippets.

en:
faker:
address:
city_prefix: [North, East, West, South, New, Lake, Port]
city_suffix: [town, ton, land, ville, berg, burgh, borough, bury, view, port, mouth, stad, furt, chester, mouth, fort, haven, side, shire]
building_number: ['#####', '####', '###']
street_suffix: [Alley, Avenue, Branch, Bridge, Brook, Brooks, Burg, Burgs, Bypass, Camp, Canyon, Cape, Causeway, Center, Centers, Circle, Circles, Cliff, Cliffs, Club, Common, Corner, Corners, Course, Court, Courts, Cove, Coves, Creek, Crescent, Crest, Crossing, Crossroad, Curve, Dale, Dam, Divide, Drive, Drive, Drives, Estate, Estates, Expressway, Extension, Extensions, Fall, Falls, Ferry, Field, Fields, Flat, Flats, Ford, Fords, Forest, Forge, Forges, Fork, Forks, Fort, Freeway, Garden, Gardens, Gateway, Glen, Glens, Green, Greens, Grove, Groves, Harbor, Harbors, Haven, Heights, Highway, Hill, Hills, Hollow, Inlet, Inlet, Island, Island, Islands, Islands, Isle, Isle, Junction, Junctions, Key, Keys, Knoll, Knolls, Lake, Lakes
@db48x
db48x / bot.rs
Last active August 29, 2015 14:01
a hypothetical way to write an IRC bot
use seen;
struct Bot {
modules: Vec<BotModule>
}
trait BotCmd { }
struct BotModule {
name: str.
@db48x
db48x / parse.js
Created May 19, 2014 04:28
a simple example of javascript parser combinators
function token(t) {
return function (text) {
if (text[0] == t)
return text.slice(1);
return false;
};
}
function and() {
var args = arguments;
@db48x
db48x / gist:a0f68f85fa6ca1420ab8
Last active August 29, 2015 14:01
parser combinators for parsing dice expressions
(defun labeled-dice-expressions ()
(series (either (label)
(nothing))
(either (dice-expression)
(nothing))))
(defun dice-expression ()
(series (sum-expression)
(optional (whitespace))
(token "⇒")
impl Header for Expires {
fn parse_header(raw: &[Vec<u8>]) -> Option<Expires> {
require_single_field!(raw);
match Header::parse_header(raw) {
Some(tm) => Some(ExpiresDate(tm)),
None => Some(Past),
}
}
fn fmt_header(&self, w: &mut Writer) -> fmt::Result {
rustc -O src/httpcommon/lib.rs --out-dir=build -L build
src/httpcommon/headers/stuff.rs:22:9: 22:34 error: missing documentation for a struct
src/httpcommon/headers/stuff.rs:22 pub struct $struct_ident;
^~~~~~~~~~~~~~~~~~~~~~~~~
src/httpcommon/headers/stuff.rs:20:1: 30:2 note: in expansion of header!
src/httpcommon/headers/stuff.rs:32:1: 32:37 note: expansion site
src/httpcommon/lib.rs:24:9: 24:20 note: lint level defined here
src/httpcommon/lib.rs:24 #![deny(missing_doc)]
^~~~~~~~~~~
src/httpcommon/headers/stuff.rs:22:9: 22:34 error: missing documentation for a struct
var emulator = new Emulator(document.querySelector("#canvas"),
null,
new AMIGALoader(AMIGALoader.model("A2000"),
AMIGALoader.nativeResolution(720, 568),
AMIGALoader.emulatorJS("emulators/amiga/amiga.js"),
AMIGALoader.mountFile("Kickstart v3.1 r40.63 (1993)(Commodore)(A500-A600-A2000)[!].rom",
AMIGALoader.fetchFile("Bios",
"examples/Kickstart v3.1 r40.63 (1993)(Commodore)(A500-A600-A2000)[!].rom")),
AMIGALoader.rom("Kickstart v3.1 r40.63 (1993)(Commodore)(A500-A600-A2000)[!].rom"),
AMIGALoader.mountFile("17Bit-Cyclic.adf",
@db48x
db48x / example.js
Last active July 29, 2016 02:58
amiga example
var emulator = new Emulator(document.querySelector("#canvas"),
null,
new AMIGALoader(AMIGALoader.model("A2000"),
AMIGALoader.fastMemory(2),
AMIGALoader.nativeResolution(720, 568),
AMIGALoader.emulatorJS("emulators/amiga/amiga.js"),
AMIGALoader.mountFile("Kickstart v3.1 r40.63 (1993)(Commodore)(A500-A600-A2000)[!].rom",
AMIGALoader.fetchFile("Bios",
"examples/Kickstart v3.1 r40.63 (1993)(Commodore)(A500-A600-A2000)[!].rom")),
AMIGALoader.rom("Kickstart v3.1 r40.63 (1993)(Commodore)(A500-A600-A2000)[!].rom"),
# Assign identifier and collection to variables for use in final output.
.metadata.identifier as $i |
.metadata.collection as $c |
# Filter out any items that do not have files metadata.
select(.files != null) |
# Get all non-derivative files that have a file size, and slim down the metadata.
.files |
map(
@db48x
db48x / test.sh
Last active November 19, 2016 21:06
#/bin/bash -x
GIT=git
pow () {
local x=${1:-1} y=${2:-0} result=${3:-1}
if [ ${y} -gt 0 ]; then
echo "$(pow "${x}" "$((y-1))" "$((result*x))")"
else
echo "${result}"