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 | |
for i in `curl $1 |grep mp3 | awk -F\" '{print $2}'|uniq` | |
do | |
wget --limit-rate=300k --referer='http://www.top100.cn/download/download.aspx?Productid=kcadnctughhdkcbogy' -U 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12' $i | |
done |
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
<head> | |
<title><%= h(yield(:title) || "Untitled") %></title> | |
<%= stylesheet_link_tag 'application' %> | |
<%= javascript_include_tag 'jquery.1.3.2.min' %> | |
<%= yield(:head) %> | |
</head> | |
<% title "Crop Avatar" %> | |
<% content_for (:head) do %> | |
<%= stylesheet_link_tag "jquery.Jcrop" %> |
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
return nil if uploaded_file.nil? | |
extension = File.extname(uploaded_file.original_filename).downcase | |
@queued_for_write[:original] = to_tempfile(uploaded_file) | |
instance_write(:file_name, "#{Time.now.strftime("%Y%m%d%H%M%S")}#{rand(1000)}#{extension}") | |
instance_write(:content_type, uploaded_file.content_type.to_s.strip) | |
instance_write(:file_size, uploaded_file.size.to_i) | |
instance_write(:fingerprint, generate_fingerprint(uploaded_file)) | |
instance_write(:updated_at, Time.now) |
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
#解决办法 | |
location /phpmyadmin { | |
auth_basic "Tell me who you are"; | |
auth_basic_user_file passwd/htpasswd; | |
proxy_pass http://apache; | |
} |
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
private | |
def send_welcome_email | |
UserMailer.welcome_registration(self).deliver | |
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
def resize | |
@mypic = User.find(current_user.id) | |
img = Magick::Image::read(@mypic.avatar.path).first #----> [BUG] Segmentation fault | |
img.crop!(::Magick::CenterGravity,20,130,276,276,true) | |
img.write @mypic.avatar.path(:medium) | |
redirect_to :action => 'pic' | |
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
#i got some paths info from http://www.directadmin.com/paths.html and http://www.directadmin.com/forum/showthread.php?threadid=3365 | |
#welcome to join and add more for uninstall them | |
#Notice:You have to shutdown some service setup by directadmin before you restart the server. | |
#http://www.zhangyiqun.net | |
rm -rf /etc/cron.d/directadmin_cron | |
rm -rf /usr/local/directadmin | |
rm -rf /etc/virtual | |
cd /home |
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
#线上 | |
#获取代码 | |
git clone ... | |
#获取更新 | |
git pull | |
#如果在线上修改了代码,要推回 | |
git push | |
#线上代码和git版本库冲突 | |
#Your local changes to ... would be overwritten by merge | |
git fetch --all |
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
#1.Replace "artidea.me" to your master domain | |
#2.Replace "blog" to the path that you want via through "www.artidea.me" | |
RewriteCond %{HTTP_HOST} ^(www.)?artidea.me$ | |
RewriteCond %{REQUEST_URI} !^/blog/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d |
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
def my_method | |
#do something with the data/model | |
my_connection = Net::HTTP.new('www.target.com', 80) | |
reponse = my_connection.post(path_within_url, data) | |
#do something with response if you want | |
end |
OlderNewer