This file contains hidden or 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
test |
This file contains hidden or 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
test |
This file contains hidden or 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
(ql:quickload '(:drakma | |
:closure-html | |
:cxml-stp | |
:css-selectors)) | |
(defun get-page-as-xml (url) | |
(let ((str (drakma:http-request url))) | |
(chtml:parse str (cxml-dom:make-dom-builder)))) | |
(setf google-page (get-page-as-xml "http://www.google.com")) |
This file contains hidden or 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
(defpackage :hunchentoot-demo | |
(:use :cl :alexandria)) | |
(in-package :hunchentoot-demo) | |
(defclass acceptor (hunchentoot:acceptor) ()) | |
(defvar *acceptor* (make-instance 'acceptor | |
:port 8080)) | |
(defun foo (request) |
This file contains hidden or 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
(ql:quickload '(:quickproject | |
:external-program)) | |
(push | |
(lambda (pathname &rest args) | |
(setf (current-directory) (fad:pathname-as-directory pathname)) | |
(rename-file "README.txt" "README.markdown") | |
(external-program:run "git" | |
(list "init" ".")) | |
(external-program:run "git" |
This file contains hidden or 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
(defun functions-in-package (&optional (package-name (package-name *package*))) | |
"Return a list of functions available in a given package." | |
(let ((symbols nil)) | |
(do-symbols (symbol package-name) | |
(when (fboundp symbol) | |
(push symbol symbols))) | |
symbols)) | |
(defun functions-defined-in-package (&optional (package-name (package-name *package*))) | |
"Return a list of functions that are defined in a given package." |
This file contains hidden or 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
;; Discovered via http://www.adampetersen.se/articles/fizzbuzz.htm | |
;; “Write a program that prints the numbers from 1 to 100. But for | |
;; multiples of three print “Fizz” instead of the number and for the | |
;; multiples of five print “Buzz”. For numbers which are multiples of | |
;; both three and five print “FizzBuzz”.” | |
(defun multiple-p (n multiple) | |
(zerop (mod n multiple))) | |
(defun fizzbuzz () |
This file contains hidden or 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
;;; Monkey patch for the monkey lib | |
(defun monkeylib-html::emit-html-to-string (html) | |
(with-output-to-string (s) | |
(let ((monkeylib-text-output:*text-output* s)) | |
(monkeylib-html:emit-html html)))) | |
(export 'monkeylib-html::emit-html-to-string | |
(find-package :monkeylib-html)) |
This file contains hidden or 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
function handleMessage(message) { | |
try { /* master handler */ | |
try { /* sub handler */ | |
try { /* sub sub handler */ | |
if (understandsMessage(message, "sub-sub-handler")) { | |
handleMessage(message, "sub-sub-handler"); | |
} else { | |
throw "can't understand"; | |
} | |
} catch (e) { throw e; } |
This file contains hidden or 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
(ql:quickload '(:drakma :closure-html :cxml :css-selectors)) | |
(let ((page (chtml:parse | |
(drakma:http-request "http://www.google.com") | |
(cxml-dom:make-dom-builder)))) | |
(css:query "div input" page)) | |
;; | |
;; Fails with the following error message: | |
;; |