Skip to content

Instantly share code, notes, and snippets.

168.143.161.20 twitter.com
168.143.161.20 www.twitter.com
128.121.146.229 assets0.twitter.com
128.121.146.229 assets1.twitter.com
128.121.146.101 static.twitter.com
128.121.146.229 assets2.twitter.com
128.121.146.229 assets3.twitter.com
65.74.185.41 twitter.zendesk.com
65.74.185.41 help.twitter.com
@alvin2ye
alvin2ye / HTTP status code
Created August 4, 2009 01:53
http status code
100 = :continue
101 = :switching_protocols
102 = :processing
200 = :ok
201 = :created
202 = :accepted
203 = :non_authoritative_information
204 = :no_content
205 = :reset_content
206 = :partial_content
@alvin2ye
alvin2ye / alias .bashrc
Created August 5, 2009 09:56
bash alias
# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias h='history'
# rails
alias r='rake'
alias ss='./restart_service.sh'
alias sg='script/generate'
@alvin2ye
alvin2ye / gist:163176
Created August 6, 2009 06:26
rspec model test
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
module FinanceRecordSpecHelper
def valid_attributes
{
:item_type => "YinsouRecord",
:currency => "CNY",
:price => 500.12,
:loading_bill => LoadingBill.first,
:remark => "remark",
:state => "可付"
# String random
class String
def self.random(length=10)
chars = ('a'..'z').to_a + ('A'..'Z').to_a + ("0".."9").to_a + ['_']
hash = ""; length.times { hash << chars[rand(chars.size)] }; hash
end
end
def append_tree_child(node)
javascript_tag <<-js
if(window.top.Agi) {
var tree = window.top.Agi.Eip.navTree;
tree.getSelectionModel().getSelectedNode().appendChild(#{node.to_ext_tree_node.to_json})
}
js
end
@alvin2ye
alvin2ye / gist:166924
Created August 13, 2009 02:16
file list
= snippet
String random : Gist 164989
bash alias : Gist 162611
rspec model test : Gist 163176
merge git version : Gist 168847
ext croe use google cdn : Gist 171726
jquery croe use google cdn : Gist 144591
jquery window popup a iframe : Gist 290d8e313ddea49752e8
install agi-vim : Gist 173665
shell gist : Gist 173672
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class ActiveSupport::TestCase
include AuthenticatedTestHelper
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test database remains unchanged so your fixtures don't have to be reloaded
@alvin2ye
alvin2ye / gist:168847
Created August 17, 2009 02:14
merge git version
$ git remote add -f defunkt git://github.com/defunkt/grit.git
$ git checkout -b defunkt/master
$ git pull defunkt master:4f0ea0c
$ git checkout master
$ git merge defunkt/master
$ git push
@alvin2ye
alvin2ye / gist:171726
Created August 21, 2009 08:28
ext croe use google cdn
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" language="javascript">
google.load("ext-core", "3.0.0");
</script>
<script type="text/javascript" language="javascript">
Ext.onReady(function() {