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
@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
@jokester
jokester / bundle.vim
Created February 10, 2012 08:20 — forked from fanzeyi/bundle.vim
" VIM配置文件
" Author: Fanzeyi (fanzeyi1994[at]gmail.com)
" Last Modified Date: 2012-01-14 13:36
" 设置语言及编码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
set enc=utf-8
" set fencs=utf-8,ucs-bom,gbk,gb18030,shift-jis,gb2312,cp936
@jokester
jokester / students.pl
Created April 20, 2012 04:58
snippet for "why can't I subtitude functor with variable in a predicate" @ stackoverflow
% facts : sname(ID,NAME)
sname(1,ada).
sname(2,bob).
% facts : point(ID,POINT)
point(1,80).
point(2,81).
% working search in example
search_by_name(Key,Value) :-
def def_scope(name, &block)
singleton_class.send(:define_method, name) do |*args|
klass = clone
block.call(klass, *args)
klass
end
end
@jokester
jokester / gist:3272325
Created August 6, 2012 08:44
thread7632 @ script.yssy.bbs
@cases=(
'\\040==case1',
'\\\\040==case2',
'\\\\\\040==case3',
'\\\\\\\\040==case4',
'\\\\\\\\\\040==case5'
);
for(@cases){
s/^((\\\\)*)\\040/ /g and print"$_\n";
}
#!/usr/bin/python
"""minimalign.py: minimal version of anymalign.py
Adrien Lardilleux <Adrien.Lardilleux@limsi.fr>
http://users.info.unicaen.fr/~alardill/anymalign/
"""
import sys
import random
// ==UserScript==
// @name Script name
// @description Description
// @namespace http://yourwebsite.com
// @version 0.1.0
// @author Your name
// @license MIT
// @released 2013-02-17
// @updated 2013-02-17
// @match *://example.com/*