This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deffn sxml->xml (sxml) | |
(with (tag (car sxml) attrs nil children nil) | |
(if (= (caadr sxml) '@) ; if we have attributes | |
(do (if (is-a? (car (cdadr sxml)) 'list) | |
(set attrs (cdadr sxml)) ; association list attribute mode | |
(set attrs (pairs (cdadr sxml)))) ; pair list attribute mode -- plan only | |
(set children (cddr sxml))) | |
(set children (cdr sxml))) ; else, if we don't have any attributes | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(atom-feed | |
(title "David's Weblog") | |
(subtitle "An awesome weblog") | |
(link 'self "http://dpk.org.uk/feed/") | |
(each post (posts 20) | |
(entry | |
(title (post 'title)) ; maybe do an automagic thing to detect dictionary items with the same name as atom properties? | |
(id (tag-uri post)) | |
(link 'alternate (post 'permalink)) ; could be automagic, too |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Textile for Arc, version 0.1 | |
; by David Kendal | |
; still todo as of this version: links, images, lists, span attributes, footnotes | |
; also: internal preflight routine to normalise line endings, strip BOM, etc. | |
; known bugs: subscript not working due to use of tilde sign in function name | |
(load "lib/re.arc") | |
(= txt-block-names* (list "h[1-6]" "bq" "fn[0-9]+" "p" "bc" "pre") | |
txt-block-re* (string "(" (joinstr txt-block-names* "|") ")") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(load "lib/re.arc") | |
(load "albert/httpd.arc") | |
(load "albert/routes.arc") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function uuidgen() { // generate a version 4 UUID | |
// clarification: a v4 UUID is in the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx | |
// where any x is a random alphanumeric character | |
// 4 is the numeral 4 | |
// and y may only by one of 8, 9, A or B | |
$format = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'; | |
$x = '1234567890ABCDEF'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- based on John Gruber's original Safari Source in BBEdit script | |
-- http://daringfireball.net/2003/01/safari_source_in_bbedit | |
-- and duct tape | |
tell application "Safari" to set theSource to do JavaScript "window.document.documentElement.outerHTML" in document 1 | |
tell application "BBEdit" | |
activate | |
make new text window with properties ¬ | |
{contents:theSource, source language:"HTML"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php -q | |
<?php | |
// ---- NOTICE ---- | |
// THIS SCRIPT IS NO LONGER UPDATED AND HAS SIGNIFICANT BUGS | |
// The script is now maintained at https://gist.github.com/1348479 | |
$txt = new Textile; | |
print $txt->TextileThis(file_get_contents($argv[1])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use LWP::UserAgent; | |
use JSON; | |
use Getopt::Long; | |
use URI::Escape qw( uri_escape_utf8 ); | |
# options | |
my $query; | |
my $titles; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A javascript port of my Perl string capitaliser. Possibly someone who is better at | |
// DOM scripting than me could make a script that would automatically apply this to any | |
// element styled with text-transform: uppercase. | |
// Again, the algorithm is too simple to be worth insisting on attribution, but if you | |
// do use this script anywhere, please attribute it to me in a comment block somewhere. | |
// By David Kendal, http://dpk.org.uk/ | |
// see also the original perl version at http://gist.github.com/567255 | |
function is_exception (word, exceptions) { // possibly there's a routine built-in to JavaScript to do this | |
word = word.toLowerCase(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# A smarter string capitaliser. Everyone knows that in words that start with certain prefixes, | |
# the prefix should be left in lower- or mixed-case when the word is made 'all-caps.' | |
# For instance, MacDonald becomes MacDONALD rather than MACDONALD, iPod becomes | |
# iPOD instead of IPOD, etc. This script attempts to be vaguely clever about doing that while | |
# also avoiding doing the same with intercapsed or camelcased product names like QuarkXPress. | |
# The cut-off point was set at four characters because the longest surname prefix that ought | |
# to be left in mixed-case that I could think of was 'Fitz,' but this causes problems with some | |
# product names, and they can be listed in @exceptions. Included are MacBook, AirPort, WiFi, | |
# and PostScript. If you have any other word suggestions, mail them to me at the address on |
NewerOlder