Skip to content

Instantly share code, notes, and snippets.

[UIView transitionWithView:view duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
view.image = nil;
} completion:nil];
CGRect frm_up = imageView.frame;
frm_up.origin.y -= 10;
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeats
animations:^{
imageView.frame = frm_up;
}
completion:NULL
@yuanmai
yuanmai / HelloServlet.java
Created December 6, 2012 13:35
Ring Hello
import javax.servlet.http.*;
import javax.servlet.*;
public class HelloServlet extends HttpServlet {
public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setStatus(200);
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
out.println("Hello world");
out.close();
@yuanmai
yuanmai / trace.clj
Created December 3, 2012 14:28
Trace
user> (defn fib[n] (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))
#'user/fib
user> (use 'clojure.tools.trace)
nil
user> (trace-vars fib)
#'user/fib
user> (fib 3)
TRACE t3166: (user/fib 3)
TRACE t3167: | (user/fib 2)
TRACE t3168: | | (user/fib 1)
@yuanmai
yuanmai / CSharp.cs
Created December 3, 2012 07:18
Clojure data
new Dictionary<string, int>
{
{"a", 23}, {"b", 45}, {"c", 67}, {"d", 89}
};
new string[] { "Wriju", "Writam", "Deb", "Sumitra" };
@yuanmai
yuanmai / gist:4029880
Created November 7, 2012 06:46
Invisible Cell
cell.backgroundView.backgroundColor = [UIColor clearColor];
cell.contentView.backgroundColor = [UIColor clearColor];
cell.selectedBackgroundView = cell.backgroundView;
@yuanmai
yuanmai / gist:3793087
Created September 27, 2012 09:24
PicoLisp Chess 笔记
# 16jul11abu
# (c) Software Lab. Alexander Burger
# *Board a1 .. h8
# *White 白方棋子
# *Black
# *WKPos 白方King位置
# *BKPos *Pinned
# *Depth *Moved *Undo *Redo *Me *You
@yuanmai
yuanmai / gist:3792409
Created September 27, 2012 05:50
PicoLisp dynamic scoping
(de f (X)
(g))
(de g ()
X)
(f 1)
-> 1
@yuanmai
yuanmai / gist:3741771
Created September 18, 2012 07:26
xinetd 80 port redirect to Jetty
service http
{
disable = no
socket_type = stream
user = root
wait = no
redirect = 127.0.0.1 3000
log_type = FILE /tmp/somefile.log
}
@yuanmai
yuanmai / gist:3681734
Created September 9, 2012 00:56
sha1 a file
openssl sha1 ${FILE_PATH} | sed 's/SHA1(.*)= //'