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 remove_tag | |
@project = Project.find(params[:id]) | |
@project.type_list.remove(params[:tag]) | |
@project.save | |
redirect_to projects_path, :flash => { :success => "Updated - tag nuked."} | |
end | |
Updated route: | |
resources :projects |
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 yue(dir) | |
Dir::foreach(dir) do |file| | |
if file.eql? "." or file.eql? ".." | |
nil | |
else | |
if File.directory? dir+"/"+file | |
yue(dir+"/"+file) | |
else | |
puts dir+"/"+file | |
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
require "nokogiri" | |
require "spidr" | |
require "open-uri" | |
def yue | |
Spidr.site("http://www.somedomain.com") do |spider| | |
spider.every_html_page do |page| | |
name = page.title | |
doc = Nokogiri::HTML(page.body) | |
doc.css(".left_content2").each do |a| | |
contents = a.content |
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
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<div id="form"> | |
<form method="post" name="form"> | |
<input type="text" name="name" id="input" /> |
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
function cloneObject(obj){ | |
var o = obj.constructor === Array ? [] : {}; | |
for(var i in obj){ | |
if(obj.hasOwnProperty(i)){ | |
o[i] = typeof obj[i] === "object" ? cloneObject(obj[i]) : obj[i]; | |
} | |
} | |
return o |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Default Partition</key> | |
<string>hd(0,6)</string> | |
<key>Instant Menu</key> | |
<string>yes</string> | |
<key>Quiet Boot</key> | |
<string>Yes</string> |
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
keycode 66 = Control_L | |
clear Lock | |
add Control = Control_L | |
keycode 49 = Escape | |
keycode 22 = grave asciitilde grave asciitilde | |
keycode 37 = Escape | |
keycode 135 = Caps_Lock | |
keycode 105 = BackSpace BackSpace BackSpace BackSpace | |
keycode 133 = Alt_L Meta_L Alt_L Meta_L | |
keycode 64 = Super_L NoSymbol Super_L |
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/bash | |
mysqldump -uroot -ppassword databasename > /root/mysql.sql | |
date=`date +%Y-%m-%d` | |
zip -P zipassword /home/mysqlback/$date.zip /root/mysql.sql | |
chown mysqlback:mysqlback /home/mysqlback/$date.zip |
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/bash | |
set -e | |
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module.git ./filter | |
if [[ -s nginx-1.2.7.tar.gz ]]; then | |
echo nginx exists, ready to extract; | |
else | |
echo Nothing found, downloading ... | |
wget -c http://soft.vpser.net/web/nginx/nginx-1.2.7.tar.gz | |
fi | |
tar -zxvf nginx-1.2.7.tar.gz |
OlderNewer