Skip to content

Instantly share code, notes, and snippets.

View jmercouris's full-sized avatar
🌴

John Mercouris jmercouris

🌴
View GitHub Profile
CL-USER> (com.informatimago.small-cl-pgms.sedit:sedit '(list :a "fish" :b "salmon"))
Sexp Editor:
【(LIST :A "fish" :B "salmon")】
> i
sexp to be inserted before: n
(N 【(LIST :A "fish" :B "salmon")】)
> n
(defun get-products ()
(with-connection (db)
(let ((products (retrieve-all
(select (:id :name :short-description :price)
(from :product)))))
(loop for product in products
do (let* ((product-id (getf product :id))
(product-features (retrieve-all
(select (:feature :description)
(from :product-features)
(defun run-sql-script (script-name)
"Run a script located within the sql directory."
(format t "Running script ~a" script-name)
(let* ((path (merge-pathnames config:*sql-directory* script-name))
(sql-file-string (uiop:read-file-string path))
(sql-queries (mapcar #'str:trim (str:split ";" sql-file-string :omit-nulls t)))
(sql-queries (remove-if (lambda (x) (equal x "")) sql-queries)))
(with-connection (db)
(loop for sql-query in sql-queries do
(cl-dbi:do-sql *connection* sql-query)))))
(defun connection-settings (&optional (db :maindb))
(cdr (assoc db (config :databases))))
(defun db (&optional (db :maindb))
(apply #'cl-dbi:connect-cached (connection-settings db)))
(defmacro with-connection (conn &body body)
`(let ((*connection* ,conn))
,@body))
DB Error: NIL (Code: NIL)
[Condition of type DBI.ERROR:<DBI-DATABASE-ERROR>]
Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [REMOVE-FD-HANDLER] Remove #<SB-IMPL::HANDLER INPUT on descriptor 6: #<CLOSURE (LABELS SWANK/SBCL::RUN :IN SWANK/BACKEND:ADD-FD-HANDLER) {100437496B}>>
3: [ABORT] Exit debugger, returning to top level.
Backtrace:
(defmacro define-mode (name direct-superclasses direct-slots &body body)
`(progn
(defclass ,name ,direct-superclasses ,direct-slots)
(progn ,@body)))
; SLIME 2.22
CL-USER> (require :cffi)
NIL
CL-USER> (push (format nil "~a/.guix-profile/lib/" (uiop:getenv "HOME")) cffi:*foreign-library-directories*)
("/home/ambrevar/.guix-profile/lib/")
CL-USER>
WARNING: System definition file #P"/home/ambrevar/.quicklisp/dists/quicklisp/software/cl-strings-20180131-git/cl-strings.asd" contains definition for system "cl-strings-tests". Please only define "cl-strings" and secondary systems with a name starting with "cl-strings/" (e.g. "cl-strings/test") in that file.
WARNING: UIOP/VERSION:PARSE-VERSION: "2018.01.02" contains leading zeros
WARNING: Invalid :version specifier "2018.01.02" for component "cl-string-match" from file #P"/home/ambrevar/.quicklisp/dists/quicklisp/software/cl-string-match-20180131-hg/cl-string-match.asd", using NIL instead
WARNING: System definition file #P"/home/ambrevar/.quicklisp/dists/quicklisp/software/cl-fad-20180430-git/cl-fad.asd" contains definition for system "cl-fad-test". Please only define "cl-fad" and secondary systems with a name sta
dispatch_sync(dispatch_get_main_queue(), ^{
if ([event timestamp] != 1) {
[super sendEvent: [NSEvent keyEventWithType:NSEventTypeKeyDown
location:[event locationInWindow]
modifierFlags:[event modifierFlags]
timestamp:1
windowNumber:[event windowNumber]
context:nil
characters:[event characters]
charactersIgnoringModifiers:[event charactersIgnoringModifiers]
//
// NextApplication.m
// next-cocoa
//
// Created by John Mercouris on 3/25/18.
// Copyright © 2018 Next. All rights reserved.
//
#import "NextApplication.h"
#include <xmlrpc-c/base.h>
//
// Copyright © 2017-2018 Atlas Engineer LLC.
// Use of this file is governed by the license that can be found in LICENSE.
//
#import "Base.h"
#import "Minibuffer.h"
@implementation Base