Skip to content

Instantly share code, notes, and snippets.

;
var Node = function(value) {
this._datum = value;
};
Node.prototype = {
get datum() {
return this._datum
},
set datum(v) {
@PuercoPop
PuercoPop / gist:6135206
Created August 1, 2013 20:55
When trying to compile guile emacs
~ $ cd Projects/emacs/
~/Projects/emacs $ make
[ -r "/Users/PuercoPop/Projects/emacs/src/config.in" ] || ( cd /Users/PuercoPop/Projects/emacs && autoheader )
cd lib && /usr/bin/make all \
CC='gcc -std=gnu99' CFLAGS='-g3 -O2' CPPFLAGS='' \
LDFLAGS='-L/usr/X11/lib' MAKE='/usr/bin/make'
/usr/bin/make all-am
make[2]: Nothing to be done for `all-am'.
cd lib-src && /usr/bin/make all \
CC='gcc -std=gnu99' CFLAGS='-g3 -O2' CPPFLAGS='' \
@PuercoPop
PuercoPop / gist:6134786
Created August 1, 2013 20:09
cd /Users/PuercoPop/quicklisp/local-projects/cl-pfds/src/ 1 compiler notes: binary-tree.lisp:92:6: error: return for unknown block: :FIRST-CASE Compilation failed.
(defmethod insert :around (element (node node))
"Wrap the function call around a catch statement so to prevent unnecesary
copying when element already belongs in the tree. When run for the first time,
setup handler case of the element already present."
(cond ((not (boundp 'first-call))
(block :first-case
(let ((first-call-result (let ((first-call t)
(result (call-next-method)))
(declare (ignore first-call))
result)))
@PuercoPop
PuercoPop / 2.4 PFDS
Created August 1, 2013 16:58
What is the best approach for setting flag in an method? I could set a global an book keep but then there can only be one insertion method at the time. I could also pass it as an extra parameter in the method call but that would pollute the signature. There is probably a better way to do this.
(define-condition element-already-present (error)
((text :initarg :text :reader text)))
(defmethod insert :around (element (node node))
"Wrap the function call around a catch statement so to prevent unnecesary
copying when element already belongs in the tree. When run for the first time,
setup handler case of the element already present."
(cond ((first-call
(handler-case
(progn
@PuercoPop
PuercoPop / profile-dotemacs.el
Created July 20, 2013 10:11
Modified profile-dotemacs.el with a default face so that when the 'default face face-background and foreground are unspecified-bg the script works non the less http://randomsample.de/profile-dotemacs.el
;;; profile-dotemacs.el --- Profile your Emacs init file
;; Copyright (C) 2010, 2012 David Engster
;; Author: David Engster <[email protected]>
;; This file is NOT part of GNU Emacs.
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
(defun merge-plists (list-a list-b)
"If a key from list-b does not exist in list-a add it to it."
(let ((*merged-list* (copy-list list-a)))
(declare (special *merged-list*))
(loop for key in list-b by #'cddr
do
(unless (getf list-a key)
(setf *merged-list* (append *merged-list* `(,key ,(getf list-b key))))))
*merged-list*))
@PuercoPop
PuercoPop / gist:5946671
Last active December 19, 2015 11:19
Improving with Bike's suggestion
(defun between-quotes (str)
(let* ((first-quote (1+ (position #\' str))) ; We want the char after first-quote
(second-quote (position #\' str :start first-quote)))
(subseq str first-quote second-quote)))
(between-quotes "PDV_n7215679='d6ad8e8a94|1124';PD_vote7215679(0);")
@PuercoPop
PuercoPop / setup-packa.el
Created June 29, 2013 06:01
For Kirbuchi
(setq lexical-binding t)
(require 'package)
;; Add marmalade to package repos
;; default value for package-archives
;; (("gnu" . "http://elpa.gnu.org/packages/"))
(let
((marmalade '("marmalade" . "http://marmalade-repo.org/packages/"))
(melpa '("melpa" . "http://melpa.milkbox.net/packages/"))
(org '("org" . "http://orgmode.org/elpa/")))
@PuercoPop
PuercoPop / gist:5856013
Created June 25, 2013 04:53
Pro tip for kirbuchi
(load (expand-file-name "~/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "sbcl"
slime-export-save-file t
slime-repl-history-remove-duplicates t
slime-repl-history-trim-whitespaces t)
;(require 'slime-asdf)
(global-set-key "\C-z" 'slime-selector)
(ql:quickload :postmodern)
(defpackage :test-case
(:use :cl)
(:import :pomo))
(in-package :test-case)
;; (defclass dao-class (standard-class)
;; ((direct-keys :initarg :keys :initform nil :reader direct-keys)
;; (effective-keys :reader dao-keys)
;; (table-name)