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
;; Initialize Biwascheme interpreter on frontend(browser) then send and receive expressions with websocket client | |
;; INSTALL websocket.el, LOAD this file and RUN interactive function `load-ws` from Emacs | |
;; ws-close to close server | |
;; send expression (e.g functions) to browser with `C-c C-s` ... Tip# cursor should be on function name | |
(defun load-ws () | |
(interactive) | |
(load-file "~/.emacs.d/websocket.el") | |
(start-ws) | |
(start-repl)) |
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
define_libfunc("http-post-call", 2, 2, function(ar){ // path , data and method (post/put/delete) | |
var path = ar[0]; | |
assert_string(path); | |
var data = ar[1]; | |
var method = ar[2]; | |
return new BiwaScheme.Pause(function(pause){ | |
$.ajax({ | |
url: path, | |
type: method, |
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
(define (rassoc key alist) ;; remove alist entry with key | |
(define (eq- pair) | |
(not (string=? key (car pair)))) | |
(filter eq- alist)) | |
(define (capitalize str) | |
(let* ((f (substring str 0 1)) | |
(s (substring str 1 (string-length str)))) | |
(string-append (string-upcase f) s))) |
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
;;; hunchentoot and split-sequence are required (hint: via quicklisp) | |
(defvar acceptor nil) | |
(setf *default-pathname-defaults* #p"~/code/lisp/attend/maker/") | |
(setf acceptor (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242))) | |
;;(hunchentoot:stop acceptor) |
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
// jquery required | |
// maxWidth and maxHeight can be parameters for more flexibility | |
function (img_ref) { | |
var img = $(img_ref); | |
img.on('load', function () { | |
img.css("width", "auto"); | |
img.css("height", "auto"); | |