Skip to content

Instantly share code, notes, and snippets.

@alvin2ye
alvin2ye / qs.rb
Created July 6, 2009 06:15 — forked from jmettraux/qs.rb
require 'rubygems'
require 'openwfe/engine/file_persisted_engine' # sudo gem install ruote
engine = OpenWFE::FilePersistedEngine.new(
:definition_in_launchitem_allowed => true)
#
# the process definition
class MyTodoProcess < OpenWFE::ProcessDefinition
@alvin2ye
alvin2ye / gist:141920
Created July 7, 2009 06:09
ruby benchmark
require 'benchmark'
def method_1
# `curl -d "password=403" http://wiki.agideo.com/agideowiki/authenticate >> /dev/null 2>&1 `
`curl http://f22.agideo.com >> /dev/null 2>&1 `
# `curl http://agi-alvin.javaeye.com >> /dev/null 2>&1 `
# `curl http://www.google.com >> /dev/null 2>&1 `
# `curl http://primy.agideo.com >> /dev/null 2>&1 `
# `curl http://douban.com >> /dev/null 2>&1 `
end
@alvin2ye
alvin2ye / gist:144591
Created July 10, 2009 16:07
google ajax loading
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" language="javascript">
google.load("jquery", "1.2");
google.load("jqueryui", "1.5.2"); // 不用 jQuery UI 可以不用此行
</script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
alert($);
});
@alvin2ye
alvin2ye / gist:148972
Created July 17, 2009 09:39
Ext.Toolbar
var tb = new Ext.Toolbar({
renderTo: document.body,
width: 600,
height: 100,
items: [
{
// xtype: 'button', // default for Toolbars, same as 'tbbutton'
text: 'Button'
},
@alvin2ye
alvin2ye / ext3 ajax tree click
Created July 18, 2009 02:59
ext3 ajax tree click
Ext.onReady(function(){
// shorthand
var Tree = Ext.tree;
var tree = new Tree.TreePanel({
useArrows: true,
preloadChildren :true,
autoScroll: true,
animate: true,
containerScroll: true,
@alvin2ye
alvin2ye / Ext.data.ScriptTagProxy 跨域访问
Created July 23, 2009 08:48
Ext.data.ScriptTagProxy 跨域访问
var ds = new Ext.data.Store({
proxy: new Ext.data.ScriptTagProxy({
url: 'http://extjs.com/forum/topics-remote.php'
}),
reader: new Ext.data.JsonReader({
root: 'topics',
totalProperty: 'totalCount',
id: 'post_id'
}, [
{name: 'title', mapping: 'topic_title'},
@alvin2ye
alvin2ye / gist:154333
Created July 24, 2009 14:54
install vim javascript syntax
#!/usr/bin/env bash
# - indent
# OP javascript indentation : This indentation script for OOP javascript (especially for EXTJS)
# http://www.vim.org/scripts/script.php?script_id=1936
echo "-install indent "
cd ~/.vim/indent || mkdir -p ~/.vim/indent
wget http://www.vim.org/scripts/download_script.php?src_id=7708 -O ~/.vim/indent/javascript.vim
@alvin2ye
alvin2ye / gist:157950
Created July 29, 2009 09:17
rails plugin templete
vendor/plugins/auto_complete/
vendor/plugins/auto_complete/lib
vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb
vendor/plugins/auto_complete/lib/auto_complete.rb
vendor/plugins/auto_complete/init.rb
vendor/plugins/auto_complete/README
vendor/plugins/auto_complete/Rakefile
# vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb
@alvin2ye
alvin2ye / .gitignore
Created July 29, 2009 14:29
.gitignore
log/*.log
tmp/**/*
*.swp
config/database.yml
db/*.sqlite3
*.log
db/schema.rb
@alvin2ye
alvin2ye / application.hmtl.erb
Created July 30, 2009 02:33
application.layout
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title><%= h(yield(:title) || PROJECT_NAME) -%></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="Ocean shipping" />
<meta name="keywords" content="Ocean shipping" />
<%= javascript_include_tag :defaults -%>
<%# stylesheet_link_tag "http://yui.yahooapis.com/2.6.0/build/reset-fonts-grids/reset-fonts-grids.css" %>
<%= stylesheet_link_tag "reset-fonts-grids" %>