This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript trim | |
function Trim(s) { | |
var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/); | |
return (m == null) ? "" : m[1]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select_tag :status, options_for_select([["全部", -1]] + Milestone.status_options, (params[:status] || Milestone::STATUS_ACTIVE).to_i), | |
:onchange => "window.location = '#{project_path(@project)}?status=' + this.value; " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
scrot -s -b -q 1 -e 'mv $f ~/桌面/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# = S3 Rake - Use S3 as a backup repository for your SVN repository, code directory, and MySQL database | |
# | |
# Author:: Adam Greene | |
# Copyright:: (c) 2006 6 Bar 8, LLC., Sweetspot.dm | |
# License:: GNU | |
# | |
# UPDATE: please retrieve latest code from github: | |
# http://github.com/skippy/s3_rake_tasks | |
# This file can now be located at: | |
# http://github.com/skippy/s3_rake_tasks/tree/master/tasks/s3_original.rake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
response.should have_tag("tr[id=finance-record-#{finance_records(:one).id}]") do | |
with_tag "a", "编辑" | |
with_tag "a", "删除" | |
with_tag "a", "勾账" | |
end | |
# completed | |
response.should have_tag("tr[id=finance-record-#{finance_records(:two).id}]") do | |
without_tag "a", "编辑" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Delete a tweet on Twitter | |
copy from http://feeds.dzone.com/~r/snippets/ruby/~3/gdGhzZh5GGs/8233 | |
headers = { | |
"User-Agent" => "Ruby v1.8", | |
"X-Twitter-Client" => "Ruby", | |
"X-Twitter-Client-Version" => "1.8" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TempleteMethod | |
class Report | |
attr_accessor :title, :content | |
def initialize | |
@title = "I am a title" | |
@content = "I am a content" | |
hook_process | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove apt-get nginx | |
sudo apt-get remove nginx | |
sudo gem install passenger | |
sudo passenger-install-nginx-module | |
# setting project | |
sudo vi /opt/nginx/conf/nginx.conf | |
server { | |
listen 80; | |
server_name hw.agideo.com; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE MASTER | |
GO | |
SP_CONFIGURE 'ALLOW UpdateS',1 RECONFIGURE WITH OVERRIDE | |
GO | |
Update SYSDATABASES SET STATUS =32768 Where NAME='置疑的数据库名' | |
Go | |
sp_dboption '置疑的数据库名', 'single user', 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cookie='_rghost_session=BAh7CToQX2NzcmZfdG9rZW4iMW41S0ZQYVBOUFpHakY3NjBSQVdVSkRsSlFRNEpIMlRoOGxPaWlOeXFvUE09OglsYW5nIgplbi1VUyIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7ADoRdXBsb2FkZWRfaWRzWwZpA%2BwKAQ%3D%3D--0d0e906fea9cd812bd87461af94c0c464c0b4b66' | |
authenticity_token='n5KFPaPNPZGjF760RAWUJDlJQQ4JH2Th8lOiiNyqoPM=' | |
url=`curl -b $cookie \ | |
-F authenticity_token="$authenticity_token" \ | |
-F file="@$1" \ | |
http://phonon.rghost.ru/files | grep 'rghost.ru/[0-9]*' -o` | |
echo "http://$url" |