Skip to content

Instantly share code, notes, and snippets.

View svetlyak40wt's full-sized avatar
💭
Making Ultralisp.org

Alexander Artemenko svetlyak40wt

💭
Making Ultralisp.org
View GitHub Profile
@svetlyak40wt
svetlyak40wt / svn-blame-stats.lisp
Created January 22, 2021 20:46
A short script to calculate how many lines belong to each SVN commiter
(defpackage #:blame-stats
(:use #:cl))
(in-package blame-stats)
(ql:quickload '(alexandria cl-fad str lparallel)
:silent t)
(defun merge-hash-table-into (left right)
"Merges values from right hash map into the left"
@svetlyak40wt
svetlyak40wt / travis-badges.lisp
Last active January 20, 2021 22:30
A generator for Travis Matrix badges.
;; Run (ql:quickload :cl-yaml) before loading this script
(defpackage #:travis-badges
(:use #:cl)
(:import-from #:cl-yaml)
(:export
#:make-badges))
(in-package travis-badges)
@svetlyak40wt
svetlyak40wt / weblocks-toast.lisp
Last active December 31, 2020 13:19 — forked from bamboospirit/weblocks toast.lisp
weblocks simple toast effect (common lisp web framework ui frontend)
(ql:quickload '(:weblocks :weblocks-lass :weblocks-navigation-widget :weblocks-ui :find-port))
(defpackage app-package
(:use #:cl
#:weblocks-ui/form
#:weblocks/html)
(:import-from #:parenscript #:ps #:chain)
(:import-from #:weblocks-navigation-widget #:defroutes)
(:import-from #:weblocks/routes #:reset-routes)
(:import-from #:weblocks/session #:*session*)
@svetlyak40wt
svetlyak40wt / lw-current-lang.lisp
Created December 12, 2020 17:03
An example how to get user's preferred language on OSX and Windows using LispWorks.
#+cocoa
(defun current-language ()
(let ((lang (objc:with-autorelease-pool ()
(objc:invoke-into
'string
(objc:invoke
(objc:invoke "NSUserDefaults" "standardUserDefaults")
"objectForKey:" "AppleLanguages")
"objectAtIndex:" 0))))
;; 2019-04-29
@svetlyak40wt
svetlyak40wt / weblocks-autocomplete.lisp
Created September 24, 2020 20:11
Example of autocompletion box using Weblocks
;; This example illustrates how to call actions from JS and update the widget in response.
;; It is incomplete but could be refactored into reusable library.
;; Hope, somebody will do this some day.
(defpackage #:weblocks-autocomplete
(:use #:cl))
(in-package weblocks-autocomplete)
(ql:quickload '(weblocks log4cl))
@svetlyak40wt
svetlyak40wt / jinja2-python2.7.py
Created September 14, 2020 07:18
Test for Jinja2 performance on Python2.7
# Test for this post:
# https://40ants.com/lisp-project-of-the-day/2020/09/0188-zenekindarl.html
Python 2.7.16 (default, Apr 17 2020, 18:29:03)
Type "copyright", "credits" or "license" for more information.
IPython 5.10.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
;; This example was created to help the author of this thread:
;; https://www.reddit.com/r/Common_Lisp/comments/hu019r/what_is_the_recommended_way_to_readunderstand/
;; Before loading this code, do this in the REPL:
;; (ql:quickload '(log4cl spinneret clack lack))
(defpackage #:server-side
(:use #:cl))
(in-package server-side)
(defun transform-function-definer-options (options)
(bind ((debug-level (normalize-debug-level
(getf options :debug (max #+sbcl (sb-c::policy-quality sb-c::*policy* 'debug)
(or (production-only* 0)
1))))))
(when (> debug-level 0)
(remove-from-plistf options :inline :optimize))
(list* :debug debug-level
(remove-from-plist options :debug))))
<?xml version="1.0" encoding="UTF-8"?>
<?mso-application progid="Excel.Sheet"?><ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"><ss:Styles><ss:Style ss:Name="Normal" ss:ID="Default"><ss:Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/><ss:Font xmlns:x="urn:schemas-microsoft-com:office:excel" ss:Color="#000000" ss:Size="11" x:Family="Swiss" ss:FontName="Arial"/></ss:Style><ss:Style ss:Parent="Default" ss:ID="String"><ss:NumberFormat ss:Format="@"/></ss:Style><ss:Style ss:Parent="String" ss:ID="Notes"><ss:Font xmlns:x="urn:schemas-microsoft-com:office:excel" ss:Color="#666666" ss:Size="9" x:Family="Swiss" ss:FontName="Arial"/></ss:Style><ss:Style ss:Parent="String" ss:ID="HyperLink"><ss:Font ss:Underline="Single" ss:Color="#0000FF"/></ss:Style><ss:Style ss:Parent="Default" ss:ID="ShortDate"><ss:NumberFormat ss:Format="Short Date"/></ss:Style><ss:Style ss:Parent="Default" ss:ID="Currency"><ss:NumberFormat ss:Format="_(&quot;$&quot;* #,##0.00_);_(&quot;$&quot;* (#,##0.00);_(&quot;$&quot;*
@svetlyak40wt
svetlyak40wt / breadcrumbs.lisp
Last active March 12, 2020 14:51
A spinneret breadcrumbs example.
(defvar *breadcrumbs*)
(defun render-breadcrumbs ()
(with-html
(:ul
(loop for (text . url) in *breadcrums*
do (:li (:a :href url
text))))))