Skip to content

Instantly share code, notes, and snippets.

View qichunren's full-sized avatar
🌈
Focusing contribute

Qichunren qichunren

🌈
Focusing contribute
View GitHub Profile
@qichunren
qichunren / gist:272768
Created January 9, 2010 07:10
conf file for lighttpd server with fastcgi
We couldn’t find that file to show.
# at bottom of environment.rb
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.default_content_type = "text/html"
ActionMailer::Base.smtp_settings = {
:address => "smtp.126.com",
:port => 25,
:domain => "www.zhaoonline.com.com",
:authentication => :login,
:user_name => "boy.365@126.com",
:password => "xxxxxxxx",
@qichunren
qichunren / start.sh
Created January 9, 2010 07:20
put this file at RAILS_ROOT
#!/bin/sh
case "$1" in
start)
/usr/local/lighttpd/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf > /dev/null 2>&1
;;
stop)
killall lighttpd
;;
restart)
@qichunren
qichunren / 验证码图片
Created February 5, 2010 07:26
验证码程序
# in app/models/
class NoisyImage
require 'RMagick'
include Magick
attr_reader :code, :code_image
def initialize(length = 4)
text_size = 20
validbglinecolors = ['#FFF', '#FFF', '#FFF', '#FFF', '#FFF']
@qichunren
qichunren / oracle数据库中相关命令
Created February 24, 2010 08:04
oracle数据库命令
# 关于oracle plsql developer
imp file=xxx fromuser=xxx touser=xxx
sqlplus "/as sysdba"
startup
@qichunren
qichunren / Pager object example
Created February 26, 2010 09:55 — forked from anonymous/Pager object example
simple php framework的分页
<?PHP
// First off, how many items per page?
$per_page = 4;
// Next, get the total number of items in the database
$num_videos = $db->getValue("SELECT COUNT(*) FROM videos where status = 'approved' ORDER BY dt");
// Initialize the Pager object
$pager = new Pager($_GET['p'], $per_page, $num_videos);
@qichunren
qichunren / oracle中的存储过程
Created March 1, 2010 08:14
oracle存储过程
--搜索关键字的记录
CREATE OR REPLACE PROCEDURE P_NEWKEYWORD(
p_keyword VARCHAR
)IS
v_keyword_id number;
v_now date:=sysdate;
BEGIN
BEGIN
SELECT ID INTO v_keyword_id FROM KEYWORDS WHERE keyword=p_keyword AND ROWNUM=1;
set nu
set autoindent
colorscheme evening
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>MODAL DEMO</title>
<script type="text/javascript" src="jquery-1.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
#产生随机的密码
def generate_password
chars = ("a".."z").to_a + ("0".."9").to_a
#puts chars
Array.new(6, '').collect{chars[rand(chars.size)]}.join
end
#测试
puts generate_password