Skip to content

Instantly share code, notes, and snippets.

@rainly
rainly / git-workflow.md
Created March 17, 2011 10:34 — forked from rainux/git-workflow.md
Git Workflow

Git Workflow

Consider three remote branches origin/master, origin/staging and origin/production. The master is the shared developers' edge. Staging is what is tested before a push to production and production is the code that gets deployed.

New Development

[paperclip] identify '-format' '%wx%h' '/tmp/stream,4458,0.JPG[0]' 2>/dev/null
[paperclip] convert '"/tmp/stream,4458,0.JPG[0]" -resize "x100" -crop "100x100+16+0" +repage "/tmp/stream,4458,0,4458,0[0]"' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::PaperclipError: There was an error processing the watermark for stream,4458,0>
[paperclip] identify '-format' '%wx%h' '/tmp/stream,4458,0.JPG[0]' 2>/dev/null
[paperclip] composite '-gravity Center /home/olek/projekty/shotmix/public/images/watermark.png "/tmp/stream,4458,0.JPG[0]" -resize "640x480>" "/tmp/stream,4458,0,4458,1[0]"' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::PaperclipError: There was an error processing the watermark for stream,4458,0>
// jQuery need
setTimeout(showBTW, 1000);
function showBTW(){
$("body").append('<div class="bottom_pop_window">\
<div class="title">热门推荐<a href="#" onclick="return closeBTW();" class="close">关闭</a></div> \
<iframe src="/btw" frameborder="no"></iframe></div>');
$(".bottom_pop_window").css("bottom",-140).animate({ bottom : 10 });
}
function closeBTW(){
require 'zip/zip'
# zip files
Dir.chdir(parent_directory)
zipfile = directory + ".zip"
return false if File.exist?(zipfile)
Zip::ZipFile::open(zipfile, true) do |zf|
Dir["#{directory}/**/*"].each { |f| zf.add(f, f) }
zf.close
location ~* ^.+\.(jpg|jpeg|gif|png|bmp|ico|css|js|swf|lrc)$ {
access_log off;
expires 30d;
}
location ~* ^.+\.(mp3|wma|rar|zip|flv)$ {
expires 30d;
}
location ~* ^.+\.(htm|html|xml)$ {
jQuery(function() {
$.cookie('tz', (new Date()).getTimezoneOffset());
});
#!/bin/sh
user_email=$(git config --get user.email)
if [ "$user_email" == "[email protected]" ]
then
echo "ERROR: Please setup git pair authors!"
exit 1
fi
# coding: UTF-8
#
# 以下为 Rake 任务,功能是将普通文件系统里面的东西转移到 MongoDB GridFS 里面
# 此代码片段来自于 Homeland 项目: https://github.com/huacnlee/homeland/tree/mysql
# 场景:
# 老架构 Linux File Store, Paperclip, hash 目录:"https://github.com/huacnlee/homeland/blob/ca0bdd8ab26da7b780e2dae7eba12b79f41e6d65/config/initializers/paperclip_hashpath.rb"
# 新架构 Mongodb GridFS, Garrierwave, 继续沿用 Paperclip 目录兼容: https://github.com/huacnlee/homeland/tree/7100ce4c506cc2c4387f25e50c533e5bbcac6cc2/app/uploaders
# 整个过程不会修改任何原始数据库和上传文件
#
require 'mongo'
// Return date for internet date string (RFC822 or RFC3339)
// - RFC822 http://www.ietf.org/rfc/rfc822.txt
// - RFC3339 http://www.ietf.org/rfc/rfc3339.txt
// - Good QA on internet dates: http://developer.apple.com/iphone/library/qa/qa2010/qa1480.html
// - Cocoa date formatting: http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns
+ (NSDate *)dateFromInternetDateTimeString:(NSString *)dateString {
// Setup Date & Formatter
NSDate *date = nil;
static NSDateFormatter *formatter = nil;
framework 'Cocoa'
require 'net/https'
class SomeOperation < NSOperation
def main
http = Net::HTTP.new("mail.google.com", 443)
http.use_ssl = true
response = nil
http.start do |h|
req = Net::HTTP::Get.new("/mail/feed/atom")