This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun rename-buffer-file (newname &optional ok-if-already-exists) | |
"rename visited file (buffer-file-name) to NEWNAME | |
and appropriately change buffer name (set-visited-file-name NEWNAME). | |
NEWNAME must be string. | |
Signals a `file-already-exists' error if a file NEWNAME already exists | |
unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. | |
A number as third arg means request confirmation if NEWNAME already exists. | |
This is what happens in interactive use with M-x." | |
(interactive "FRename to: \np") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class A{ public int i; } | |
class B extends A { public int j; } | |
public class TestList{ | |
public static void main(String[] args){ | |
A a = new A(); a.i = 1; | |
B b = new B(); b.i = 2; b.j = 3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(progn (load "/usr/share/emacs/site-lisp/slime-archimag/swank-loader.lisp" :verbose t) (funcall (read-from-string "swank:start-server") "/tmp/slime.2380" :coding-system "utf-8-unix")) | |
This is SBCL 1.0.55, an implementation of ANSI Common Lisp. | |
More information about SBCL is available at <http://www.sbcl.org/>. | |
SBCL is free software, provided as is, with absolutely no warranty. | |
It is mostly in the public domain; some portions are provided under | |
BSD-style licenses. See the CREDITS and COPYING files in the | |
distribution for more information. | |
STYLE-WARNING: redefining ASDF::LISP-VERSION-STRING in DEFUN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -z "$2" ]; then | |
echo "usage: git-cp-in-history FILE DIR" | |
exit 1 | |
fi | |
FNAME="$1" | |
DNAME="$2" | |
git filter-branch --tree-filter \ | |
'if [ ! -d "'"$DNAME"'" ]; then mkdir "'"$DNAME"'"; fi; '\ | |
'if [ -f "'"$FNAME"'" -a ! -h "'"$FNAME"'" ]; then cp "'"$FNAME"'" "'"$DNAME"'"; fi' -- --all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CL-USER> (defun filtered (hash &optional (filter-condition t)) | |
(let ((res '())) | |
(maphash #'(lambda (k v) | |
(if (funcall filter-condition k v) | |
(push v res))) | |
hash) | |
res)) | |
CL-USER> (defparameter *hash* (make-hash-table)) | |
CL-USER> (dotimes (i 10) (setf (gethash i table) i)) | |
CL-USER> (filtered *hash* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -n 's/[^<>]*<[ \t\n]*set[ \t\n]\+value='\''\([^'\'']*\)'\''[ \t\n]\+name='\''\([^'\'']*\)'\''[ \t\n]*\/>[^<>]*/\n\$\$"\1","\2"\n/pg' test | sed -n 's/^\$\$\(.*\)$/\1/p;' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Registry<H extends Handler>{ | |
//абстрактный метод | |
void register(String s, H h); | |
//наш обобщенный код | |
void registerList(String s, List<H> hs){ | |
for(H h: hs) | |
register(s,h); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- ================================= | |
target: load-ivy | |
this target is not necessary if you put ivy.jar in your ant lib directory | |
if you already have ivy 1.4 in your ant lib, you can simply remove this | |
target | |
================================= --> | |
<target name="load-ivy"> | |
<!-- try to load ivy here from home ivy dir, in case the user has not already dropped | |
it into ant's lib dir (note that the latter copy will always take precedence). | |
We will not fail as long as ivy home lib dir exists (it may be empty) and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun test(&rest ab) | |
(let ((len (length ab)) | |
(a 2) b) | |
(cond ((< 2 len) (error "Too many args")) | |
((= 2 len) | |
(setf a (first ab) | |
b (second ab))) | |
((= 1 len) (setf b (first ab))) | |
(t (error "B arg is mandatory"))) | |
(format t "a: ~W, b: ~W~%" a b))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CL-USER> (ql:quickload "cl-json") | |
To load "cl-json": | |
Load 1 ASDF system: | |
cl-json | |
; Loading "cl-json" | |
("cl-json") | |
CL-USER> (use-package :json) | |
T | |
CL-USER> (encode-json-to-string '((:a (:b . "test")))) |
OlderNewer