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
;;;; Copyright (c) 2010 Olexiy Zamkoviy <[email protected]> | |
;;;; | |
;;;; Permission is hereby granted, free of charge, to any person obtaining | |
;;;; a copy of this software and associated documentation files (the | |
;;;; "Software"), to deal in the Software without restriction, including | |
;;;; without limitation the rights to use, copy, modify, merge, publish, | |
;;;; distribute, sublicense, and/or sell copies of the Software, and to | |
;;;; permit persons to whom the Software is furnished to do so, subject to | |
;;;; the following conditions: | |
;;;; |
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
(defvar *files-modification-stamps* (make-hash-table :test #'equal)) | |
(defun load-modified-files() | |
(dolist (i (directory "src/**/*.lisp")) | |
(let* ((mtime-unix (sb-posix:stat-mtime (sb-posix:stat i))) | |
(cell (or (gethash i *files-modification-stamps*) (setf (gethash i *files-modification-stamps*) mtime-unix))) | |
(any-file-modified nil)) | |
(when (< cell mtime-unix) | |
(format t "Updated file ~A with last-modified time ~A~%" i mtime-unix) | |
(load (compile-file i)) | |
(setf (gethash i *files-modification-stamps*) mtime-unix) |
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
(in-package :swank) | |
(defun my-repl-eval (string) | |
(format t "; Reseting weblocks sessions~%") | |
(weblocks:reset-sessions) | |
(repl-eval string)) | |
(setq *listener-eval-function* #'my-repl-eval) |
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
// This snippet depends on https://gist.github.com/ccbeea00dd952bbe7eb4 | |
function getScripts(collection, endcallback){ | |
if(collection.length == 0){ | |
return endcallback && endcallback(); | |
} | |
jQuery.getScript(collection[0], function(){ | |
getScripts(collection.slice(1), endcallback); | |
}); |
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
function eachStep(collection, callback, endcallback){ | |
if(collection.length == 0){ | |
return endcallback && endcallback(); | |
} | |
jQuery.when(callback(collection[0])).always(function(){ | |
eachStep(collection.slice(1), callback, endcallback); | |
}); | |
} |
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
function getFiles(collection, callback){ | |
eachStep(collection, | |
function(source){ | |
return jQuery.get(source); | |
}, callback); | |
} |
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
// Stolen from jquery-ui and customized | |
(function($){ | |
$.fn.disableSelection = function(){ | |
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + | |
".disableSelection", function( event ) { | |
event.preventDefault(); | |
}); | |
}; | |
$.fn.enableSelection = function(){ |
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
(defun transliterate-cyr-to-lat-russian (text) | |
; Taken from http://cl-cookbook.sourceforge.net/strings.html | |
(defun replace-all (string part replacement &key (test #'char=)) | |
"Returns a new string in which all the occurences of the part | |
is replaced with replacement." | |
(with-output-to-string (out) | |
(loop with part-length = (length part) | |
for old-pos = 0 then (+ pos part-length) | |
for pos = (search part string | |
:start2 old-pos |
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
(defmacro with-yaclml (&body body) | |
"A wrapper around cl-yaclml with-yaclml-stream macro." | |
`(yaclml:with-yaclml-stream *weblocks-output-stream* | |
,@body)) |
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
(defun normalize-newlines (string) | |
(ppcre:regex-replace-all (format nil "~C(\n)?" #\return) string "\n")) | |
(assert (string= (normalize-newlines "as\ndf") "as\ndf")) | |
(assert (string= (normalize-newlines (format nil "as~C\ndf" #\return)) "as\ndf")) | |
(assert (string= (normalize-newlines (format nil "as~Cdf" #\return)) "as\ndf")) |
OlderNewer