Skip to content

Instantly share code, notes, and snippets.

😇
nemui

Eitaro Fukamachi fukamachi

😇
nemui
View GitHub Profile
View fmt.ros
#!/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 Dec 13, 2016
A function for shelly to load a file ignoring shebang. This is useful to write a script with Common Lisp.
View script.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)))
View copy-directory.lisp
(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 Dec 18, 2015
Hand off slime doc search to a website, bound to C-c C-d C-s, defaults to quickdocs.org.
View slime-documentation-search.el
;;; -*- 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)))
View DBIx-Lite-ResultSet-Role-Slave.pm
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 Jul 4, 2012
Router: a router that can be combined with jquery.pjax.js
View router.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 Jan 30, 2012
UNIVERSAL::the
View the.pl
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 Jan 6, 2012 — forked from hitode909/dict.py
非同期に辞書を引く
View dict.m
// 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;
You can’t perform that action at this time.