Skip to content

Instantly share code, notes, and snippets.

@chebert
chebert / lisp.el
Created September 3, 2017 01:05
chebert-eval-print-last-sexp
(defun multiline? (string)
(position ?\n string))
(defun multiline-comment (string)
(concat "#||\n" string "\n||#\n"))
;; Note: Redefining to send the error message too.
(defun chebert-eval-async (sexp &optional cont package)
"Evaluate EXPR on the superior Lisp and call CONT with the result."
(declare (indent 1))
@chebert
chebert / matrix.lisp
Last active December 27, 2019 14:06
Example of How Matrices could be implemented using Vectors In Lisp
(defun make-vector (length elt) (make-array length :initial-element elt))
(defun vector-elt (vec i) (aref vec i))
(defun vector-set! (vec i elt) (setf (aref vec i) elt))
(defun matrix (m n vec) (list m n vec))
(defun matrix-m (m) (first m))
(defun matrix-n (m) (second m))
(defun matrix-vec (m) (third m))
(defun num-elements (m n)
@chebert
chebert / pacman.lisp
Created September 30, 2015 19:14
pacman, ncurses, lisp
(defpackage :pacman
(:use :cl))
(in-package :pacman)
;;; The charms/ll library contains all of the FFI bindings to Ncurses.
(ql:quickload :cl-charms)
;;; Here are all of the functions I'll be using from Ncurses.
(import '(
@chebert
chebert / pacman.c
Last active April 26, 2018 09:48
pacman ncurses
/*
map ,g :!gcc % -o %:r -lncurses && ./%:r <CR>
*/
#include <assert.h>
#include <stdint.h>
#include <ncurses.h>
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
@chebert
chebert / SendToTmux
Last active August 29, 2015 14:14
Send keys to another buffer in a tmux session. Pretty handy.
nmap <silent> <leader>s :set opfunc=SendToTmux<CR>g@
nmap <silent> <leader>ss :call SendLineToTmux()<CR>
vmap <silent> <leader>s :<C-U>call SendToTmux(visualmode(), 1)<CR>
function! SendLineToTmux()
let line = line('.')
let col = col('.')
" TODO: this assumes the leader is ','
:normal 0,s$""
@chebert
chebert / gist:a501fc6c67b4ae406eb4
Last active August 29, 2015 14:12
full-sound-test
(define-foreign-library alsa
(t (:default "libasound")))
(defcenum snd-pcm-stream-t
:snd_pcm_stream_playback
:snd_pcm_stream_capture)
(defcenum snd-pcm-state-t
:SND_PCM_STATE_OPEN
:SND_PCM_STATE_SETUP
struct FileChooserDialog {
private:
struct FileCompare {
bool operator() (const Glib::RefPtr<Gio::File>& a, const Glib::RefPtr<Gio::File>& b) const {
std::clog << (a->equal(b) ? "equal" : "not equal") << std::endl;
return a->equal(b);
}
};
public:
set nocompatible
filetype off
"Bundles
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'embear/vim-localvimrc'
Available Fonts:
A-OTF Futo Min A101 Pr5 Bold
A-OTF Futo Min A101 Pro Bold
A-OTF Midashi Min MA31 Pr5 MA31
A-OTF Midashi Min MA31 Pro MA31
A-OTF Ryumin Std B-KO
A-OTF Ryumin Std B-KS
A-OTF Ryumin Std H-KO
A-OTF Ryumin Std H-KS
A-OTF Ryumin Std L-KO
@chebert
chebert / gist:6966302
Created October 13, 2013 19:18
table not receiving updates
var authenticationToken = "thisisasupercutelittletokenfortestingandsuch";
Realtime.Storage.create({
applicationKey: "jpj5BT",
authenticationToken: authenticationToken,
isSecure: true,
}, onSuccess, errorFunc);
function onSuccess(storageRef) {
storageRef.table('chat_messages').on('update', 'Lgq4I3Pzjjk7T3nX', console.error.bind(console), console.error.bind(console));
}