Skip to content

Instantly share code, notes, and snippets.

@html
html / countries-translation-code.lisp
Created May 13, 2016 00:25
All countries in English and Russian parsing
(defvar *countries* (list "Bangladesh" "Belgium" "Burkina Faso" "Bulgaria" "Bosnia and Herzegovina" "Brunei" "Bolivia" "Japan" "Burundi" "Benin" "Bhutan" "Jamaica" "Botswana" "Brazil" "The Bahamas" "Belarus" "Belize" "Russia" "Rwanda" "Republic of Serbia" "Lithuania" "Luxembourg" "Liberia" "Romania" "Guinea Bissau" "Guatemala" "Greece" "Equatorial Guinea" "Guyana" "Georgia" "United Kingdom" "Gabon" "Guinea" "Gambia" "Greenland" "Kuwait" "Ghana" "Oman" "Somaliland" "Western Sahara" "Kosovo" "Northern Cyprus" "Jordan" "Croatia" "Haiti" "Hungary" "Honduras" "Puerto Rico" "West Bank" "Portugal" "Paraguay" "Panama" "Papua New Guinea" "Peru" "Pakistan" "Philippines" "Poland" "Zambia" "Estonia" "Egypt" "South Africa" "Ecuador" "Albania" "Angola" "Kazakhstan" "Ethiopia" "Zimbabwe" "Spain" "Eritrea" "Montenegro" "Moldova" "Madagascar" "Morocco" "Uzbekistan" "Myanmar" "Mali" "Mongolia" "Macedonia" "Malawi" "Mauritania" "Uganda" "Malaysia" "Mexico" "Vanuatu" "France" "Finland" "Fiji" "Falkland Islands" "Nicaragua" "Neth
;;;; memory.lisp
;;; 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:
;;;
(in-package :weblocks)
(setf *enable-timings* t)
(defvar *timings-data* nil)
(defvar *tree-path* nil)
(defun reverse-timings-data (data)
"During collection of log data it appends in wrong order due to technical reasons. This function reverses data back"
(unless data
@html
html / guerrilla-funcs
Created July 11, 2014 13:47
Guerrilla mail api functions
(defvar *last-email-id* nil)
(defvar *last-email*)
(defvar *guerrilla-cookie*)
(defun drakma-request (&rest args)
; posible errors 'drakma::drakma-simple-error
; usocket:timeout-error
(let ((result))
(loop do
@html
html / codemirror-mustache.js
Created December 18, 2013 00:57
Codemirror mustache mode, borrowed from CodeMirror source (mustache example)
/*
Copyright (C) 2013 by Marijn Haverbeke <marijnh@gmail.com> and others
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:
@html
html / yaclml-syntax-improvement.lisp
Last active December 27, 2015 03:19
Enable shorter syntax for yaclml. Also this allows to create yaclml tags dynamically.
#|
Version: 0.0.3
Example of using yaclml after this code evaluating
CL-USER> (<a :href "asdf" "jkl")
<a href="asdf"
>jkl</a
>; No value
CL-USER> (<some-undefined-tag :some-parameter "asdf" "jkl")
@html
html / weblocks-bootstrap-look-navigation.lisp
Created May 28, 2013 13:22
Snippet for bootstrap like navigation for weblocks
(defwidget bootstrap-navigation (navigation)
())
(defun render-bootstrap-navbar-menu-wt (&rest args &key menu-id menu-header menu-content menu-empty-p menu-empty-message menu-ordered-list-p)
(with-html-to-string
(:div :class "navbar"
:id menu-id
(:div :class "navbar-inner"
(when menu-header
(htm (:h1 (str menu-header))))
@html
html / install-app.sh
Created May 11, 2013 09:56
Small piece of code used to deploy apps
function install-app(){
DIR_NAME="`echo "$1" | grep -o "\([^/]\+\?\)\.git" | sed -e s/.git//`"
echo "Cloning repository"
git clone "$1" && cd $DIR_NAME;
git submodule update --init
}
install-app $*
@html
html / create-weblocks-app-repository.sh
Created April 28, 2013 18:51
Function used to create repository for weblocks project
function create-weblocks-app-repository(){
NAME="$1"
mkdir "$NAME";
cd "$NAME";
git init
git submodule add git://github.com/html/quicklisp-app-skeleton.git .quicklisp-install
cp .quicklisp-install/.quicklisp-version .
echo "(progn (ql:quickload :weblocks) (funcall (intern \"MAKE-APP\" \"WOP\") '$NAME \".\"))" | sbcl --load ".quicklisp-install/require-quicklisp"
mv $NAME/* .
rm -rf "$NAME"
@html
html / timetables-parsing-util.lisp
Created April 1, 2013 07:35
Paring utilities for parsing timetables project
(defun normalize-group-result (json)
(list
(cons :group--name (cdr (assoc :group--name json)))
(cons :days
(or
(loop for day in (cdr (assoc :days json))
collect
(alexandria:alist-hash-table
(list