View Textile for BBEdit
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])); |
View gist:708653
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'; |
View albert.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
(load "lib/re.arc") | |
(load "albert/httpd.arc") | |
(load "albert/routes.arc") |
View textile.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
; 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* "|") ")") |
View gist:913932
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 |
View gist:1027863
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/ruby | |
require 'fcgi' | |
require 'less' | |
require 'digest/sha1' | |
FCGI.each do |request| | |
out = request.out | |
source = File.new(request.env["SCRIPT_FILENAME"], 'r').read; | |
hash = Digest::SHA1.hexdigest(source).inspect |
View gist:1076477
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
Domain name: | |
thesunonsunday.co.uk | |
Registrant: | |
News International Newspapers Limited | |
Registrant type: | |
UK Limited Company, (Company number: 1885543) |
View gist:1370253
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/env ruby | |
# encoding: UTF-8 | |
# live sparkline display | |
# gems required: ruby-terminfo, getoptions | |
require 'terminfo' | |
require 'getoptions' | |
def bar_height n, min, max | |
h = (((n - min) / (max - min)) * $bs).to_i |
View gist:1397778
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
(set! default-headers* '{content-type "text/html; charset=utf-8" | |
server "Plan httpd"}) | |
;; OHSHI- | |
(set! response-codes* '{100 "Continue" ; 100-199 -- informational | |
101 "Switching Protocols" | |
102 "Processing" | |
200 "OK" ; 200-299 -- success | |
201 "Created" | |
202 "Accepted" |
View gist:1402006
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
;; An implementation of the Mustache template system. (http://mustache.github.com/) | |
;; See http://mustache.github.com/mustache.5.html for the format documentation | |
;; | |
;; Usage: (mustache '{employees ({name "Bob" age "34"} {name "Jim" age "27"} {name "Sally" age "54"})} "{{#employees}}\n* {{name}} is {{age}} years old\n{{/employees}}") | |
;; ==> "\n* Bob is 34 years old\n\n* Jim is 27 years old\n\n* Sally is 54 years old\n" | |
(deffn (mustache-tokens tmpl) | |
(regexp-split (mustache-strip-comments tmpl) r“({{(?:{.+?}|[#&^/>]?.+?)}})”)) | |
(deffn (mustache-strip-comments tmpl) |