Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#|-*- mode:lisp -*-|#
#| <Put a one-line description here>
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
#+quicklisp (ql:quickload '(:lem-base :lem-lisp-syntax) :silent t)
)
@KeenS
KeenS / script.lisp
Last active December 13, 2016 07:13
A function for shelly to load a file ignoring shebang. This is useful to write a script with Common Lisp.
(in-package :shelly)
(export (defvar *argv* nil))
(in-package :cl-user)
(defun script (file argv)
"Execute a file as script ignoring shebang"
(setf shelly:*argv* argv)
(let* ((in (open file :if-does-not-exist :error))
(first-char (read-char in))
(second-char (read-char in)))
@snmsts
snmsts / copy-directory.lisp
Created June 14, 2013 02:03
copy-directory
(defun copy-directory (from to &key overwrite)
(let ((len (length (namestring (truename from)))))
(cl-fad:walk-directory
from
(lambda (x)
(cl-fad:copy-file
x
(ensure-directories-exist
(merge-pathnames
(subseq (namestring x) len)
@bhyde
bhyde / slime-documentation-search.el
Last active December 18, 2015 05:48
Hand off slime doc search to a website, bound to C-c C-d C-s, defaults to quickdocs.org.
;;; -*- lexical-binding: t -*-
(define-slime-contrib slime-documentation-search
"Hand off a documenation search to a web site."
(:authors "Ben Hyde <bhyde@pobox.com>")
(:license "GPL")
(:on-load
(define-key slime-doc-map "\C-s" 'slime-documention-search)
(define-key slime-doc-map "s" 'slime-documention-search)))
package DBIx::Lite::ResultSet::Role::Slave;
use strict;
use warnings;
use Role::Tiny;
around $_ => sub {
my ($ORIG, $self, @args) = @_;
local $self->{dbix_lite} = $self->{dbix_lite}->master;
return $self->$ORIG(@args);
} for qw(
@nanto
nanto / router.js
Created July 4, 2012 16:51
Router: a router that can be combined with jquery.pjax.js
// Router: a router that can be combined with jquery.pjax.js [1]
//
// [1] https://github.com/defunkt/jquery-pjax
//
// This file is in the public domain.
//
//
// var router = new Router();
// $(document).on('pjax:end', function () { router.dispatch(location); });
// $(function () { router.dispatch(location); });
@motemen
motemen / the.pl
Created January 30, 2012 09:09
UNIVERSAL::the
use strict;
use warnings;
use PadWalker qw(peek_my);
use Scalar::Util qw(blessed);
use Class::Load qw(is_class_loaded);
sub UNIVERSAL::the {
my $class = shift;
my $vars = peek_my(1);
my @the = grep { blessed $_ && is_class_loaded($class) ? $_->isa($class) : ref $_ eq $class } map { $$_ } values %$vars;
@peccu
peccu / dict.m
Created January 6, 2012 07:42 — forked from hitode909/dict.py
非同期に辞書を引く
// copy from https://gist.github.com/1203094
// gcc -o dict -Wall -fobjc-gc -O2 -std=c99 dict.m -framework carbon -framework cocoa
#import <Cocoa/Cocoa.h>
#import <CoreServices/CoreServices.h>
int main(int argc, char *argv[])
{
NSString *word;
NSString *result;