Skip to content

Instantly share code, notes, and snippets.

View draegtun's full-sized avatar

Barry Walsh draegtun

View GitHub Profile
@vito
vito / html.atomo.hs
Created August 7, 2010 21:38
a little HTML DSL in Atomo (incomplete)
HTML = Object clone
Association = Object clone
a -> b := Association clone do: { from = a; to = b }
Self-Closing = ["base", "meta", "link", "hr", "br", "param", "img", "area", "input", "col", "frame"]
-- creating elements with no content
-- keyword dispatch adds attributes
#!/usr/bin/perl
use 5.10.1;
use strict;
use warnings;
use HTTP::Request::Common 'POST';
use AnyEvent::HTTP;
use Benchmark;
@anttih
anttih / Assert.io
Created November 4, 2010 18:40
Tests for Object assert
Protos AssertionException := Exception clone
Object do(
assert := method(v, m,
if(true != v,
m ifNil(m = "true != (#{ call argAt(0) })" interpolate)
AssertionException raise(m)
)
)
@jneen
jneen / example.io
Created January 29, 2011 16:34
a module system for Io
# Assuming this directory structure:
#
# MyModule/
# init.io # => Object clone do( foo := "bar" )
# slot1.io # => "LOL"
# slot2.io # => method("running slot2" println; self)
# slot3/
# subslot1.io # => "this is subslot1"
import("/path/to/MyModule")
#!/usr/bin/env perl
use Mojolicious::Lite;
use EV;
use AnyEvent;
# Simple delayed rendering
get '/' => sub {
my $self = shift;
my $w;
$w = AE::timer 3, 0, sub {
@c9s
c9s / perlfold.vim
Created September 19, 2012 07:24
fold options for perl
syntax on
filetype on
filetype plugin indent on
let perl_include_pod = 1
let perl_extended_vars = 0
let perl_want_scope_in_variables = 1
let perl_fold = 1
let perl_fold_blocks = 1
set foldenable
@tobyink
tobyink / AcmeConstructorPythonic.pm
Created October 21, 2012 09:09
As per Hercynium's suggestion...
use strict;
use warnings;
BEGIN {
package Acme::Constructor::Pythonic;
no thanks;
use Data::OptList qw(mkopt);
use Sub::Install qw(install_sub);
use Module::Runtime qw(use_module);
sub import {
#!/usr/bin/env perl
use strict;
use LWP::Simple;
sub pick { $_[rand @_] }
my $text = get "https://gist.github.com/shanselman/5422230/raw/9863d88bde2f9dcf6b2e7a284dd4a428afdc8c8b/gistfile1.txt";
my @samples = split /\|\n/, $text;
my $template = pick @samples;
@maximvl
maximvl / poor-mans-scopes.red
Last active August 14, 2019 12:30
Dynamic variables in Red
Red [
author: "Maxim Velesyuk"
description: "Dynamic variables implementation for Red"
]
; utils
forskip: func ['series skipn body /local s] [
s: get series
while [ not tail? s ] [
do body
@maximvl
maximvl / restarts.red
Last active August 14, 2019 12:30
CL condition-restarts in Red
Red [
author: "Maxim Velesyuk"
description: "Common Lisp condition-restart system implementation for Red"
]
; utils
*word-counter*: 0
gen-word: does [
*word-counter*: *word-counter* + 1
to-word append "G-" to-string *word-counter*