Skip to content

Instantly share code, notes, and snippets.

View jokester's full-sized avatar
🌛
not my photo / still alive and with a cat now!!! (as of 2024-03)

Wang Guan jokester

🌛
not my photo / still alive and with a cat now!!! (as of 2024-03)
View GitHub Profile
do ->
String.prototype.to_proc = (args...)->
method = @
(obj)->obj[method].apply(obj, args...)
console.log "a b c".split(/\s/).map (i)->i["toUpperCase"]()
# => [ "A", "B", "C" ]
console.log "a b c".split(/\s/).map "toUpperCase".to_proc()
# => [ "A", "B", "C" ]
@jokester
jokester / .vimrc.bundle
Created May 14, 2014 03:33
my vim bundle
" vim: ft=vim
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" detect / switch encoding
Bundle 'mbbill/fencview'
#!/usr/bin/env bash
if which mit-scheme &>/dev/null ; then
if [ $# -gt 0 ]; then
mit-scheme --quiet < $1
else
echo "usage: $0 [scheme src]"
fi
else
echo "'mit-scheme' executable not found"
fi
(define (inc i) (+ i 1))
(define (product1 term a next b)
(if (> a b)
1
(* (term a)
(product1 term (next a) next b))))
(define (product2 term a next b)
(define (iter a result)
@jokester
jokester / Packages.txt
Created March 3, 2015 00:55
Psychtoolbox: problem loading movie file of particular format
% dpkg -l | egrep -i "psych|gstream|libgcc|libgl1|libglu1"
ii gir1.2-gst-plugins-base-1.0 1.2.4-1~ubuntu1 amd64 Description: GObject introspection data for the GStreamer Plugins Base library
ii gir1.2-gstreamer-1.0 1.2.4-0ubuntu1 amd64 Description: GObject introspection data for the GStreamer library
ii gstreamer0.10-alsa:amd64 0.10.36-1.1ubuntu2 amd64 GStreamer plugin for ALSA
ii gstreamer0.10-fluendo-mp3:amd64 0.10.23.debian-3 amd64 Fluendo mp3 decoder GStreamer 0.10 plugin
ii gstreamer0.10-nice:amd64 0.1.4-1 amd64 ICE library (GStreamer 0.10 plugin)
ii gstreamer0.10-plugins-bad:amd64 0.10.23-7.2ubuntu1 amd64 GStreamer plugins from the "bad" set
ii gstreamer0.10-plugins-base:amd64 0.10.36-1.1ubuntu2
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{
@jokester
jokester / [程序向]如何得到所有组合结果.rb
Created August 13, 2011 11:49
求数组{ (0..N1),{0..N2},...,(0..Nn) }的笛卡尔积
#!/usr/bin/ruby
puts "input N"
i=gets.to_i
m=[1]
1.upto i do |j|
puts "input N#{j}"
k=gets.to_i
m.unshift m[0]*(k+1)
@jokester
jokester / pe14.rb
Created November 1, 2011 13:19
solution to project euler no.14
#!/usr/bin/ruby
class PE14
@@l=Hash.new
@@l[1]=1
def PE14.eval x
if @@l[x] #found
return @@l[x]
else
if x%2==0 #even
y=PE14.eval(x/2)
@jokester
jokester / about.md
Created November 8, 2011 09:09 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@jokester
jokester / 12306.user.js
Created January 5, 2012 14:37 — forked from quietlynn/12306.user.js
12306 Auto Query => A javascript snippet to help you book ticket
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js