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
<script> | |
function add_plus_date(fname,yn){ | |
var source = document.getElementById(fname); | |
var reg=/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/; | |
if(ret = source.value.match(reg)){ | |
var old_date = new Date(ret[1],parseInt(ret[2])-1,ret[3],ret[4],ret[5],ret[6],0); | |
var tmp_date = old_date.valueOf() + (yn=='add' ? +1 : -1 ) * 24*60*60*1000; | |
var tmp_date = new Date(tmp_date); | |
var y = tmp_date.getFullYear(); | |
var m = tmp_date.getMonth() + 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
## 现场再现 | |
在view中form属性设置`remote: true`即通过ajax提交时,controller会创建两次,查看log文件发现也确实提交了两次。 | |
之前,还出现过在界面未刷新情况下,每通过ajax提交一次,controller中创建次数会增加一次,比如第一次创建提交会实质提交两次,第二次创建提交会提交三次... | |
这样的问题让人很无奈,因为在其他view中的创建提交都很正常,郁闷了好久,直到前段时间才发现原因,理解了为什么,心中不觉释然。 | |
## 原因 & 解决方案 |
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
系统环境:centos 5.5 | |
需要文件: | |
sqlite-amalgamation-3.6.16.tar.gz (sqlite安装包) | |
ruby-1.9.2-p180.tar.gz (ruby1.9.2安装包) | |
node-v0.4.8.tar.gz (nodejs安装包) | |
redis-2.4.16.tar.gz (redis安装包) | |
focus_mail.tar.gz (FocusMail源代码,解压后文件夹名为focus_mail_128,应修改为focus_mail) | |
mail206.tar.gz (FocusMail数据库内容) | |
redis.conf (redis配置文件,放置/etc下) |
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
#encoding: utf-8 | |
require "fileutils" | |
require 'qiniu-rs' | |
#=============================================== | |
#数据库备份位置 | |
db_bak_path = "/home/work/solife/db/db.bak" | |
raise "db_bak_path:#{db_bak_path}" unless File.exist?(db_bak_path) |
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
#!/usr/bin/env ruby | |
timestamp = Time.now.strftime("%Y/%m/%d-%H:%M:%S") | |
shell_content =<<SHELL | |
git_path=$(which git) | |
cd /home/work/solife | |
${git_path} init | |
${git_path} add -A . | |
${git_path} commit -a -m "auto commit - #{timestamp}" |
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
<script src="http://solife.us/assets/jquery.js" type="text/javascript"></script> | |
<script> | |
$(function(){ | |
$("svg path").on("click", function(e){ | |
var obj = e.target; | |
var PropertyList=''; | |
for(i in obj){ | |
if(obj.i !=null) | |
PropertyList=PropertyList+i+'属性:'+obj.i+'\r\n'; | |
else |
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
jQuery.fn.paginate = function(options) { | |
defaults = { childNodeName: 'li'} | |
var opts = $.extend(defaults, options); | |
var childNodeName = opts["childNodeName"]; | |
this.each(function(){ | |
var currentPage = 0; | |
var numPerPage = 10; | |
var $con = $(this); | |
$con.bind('repaginate',function(){ |
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 | |
#功能: | |
# 自动校正系统时区、日期、时间 | |
#校正方式一: | |
# 通过ssh取得远程主机时区、日期、时间为参照校正本机时区、日期、时间 | |
# 此方式需要设置shost=登陆用户名@参照主机ip | |
#校正方式二: | |
# 手工设置要修改参考的标准信息 | |
# 此方式需要设置sinfo="+0800 09/28/13 16:25:30" | |
#说明: |
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
# Andrew Wayne 2010 | |
# Error messages for Ruby on Rails 3 | |
# This isnt available in Rails 3 and is a custom module | |
# made to work like the previous Rails | |
# Put this in your ApplicationHelper or create an error_messages_helper.rb file | |
# in your helpers dir | |
#------------- START --------------# |
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
desc "test" | |
task :test do | |
puts "params #{ENV['parmas']}" | |
end | |
如果使用的话: | |
rake test params="test" | |