Skip to content

Instantly share code, notes, and snippets.

View lvjian700's full-sized avatar

Jian Lyu lvjian700

View GitHub Profile
@lvjian700
lvjian700 / gist:4016381
Created November 5, 2012 09:52
Shell list for rails dev
# generate ctags for rails project
ctags -R --exclude=.git --exclude=log * --exclude=coverage
@lvjian700
lvjian700 / gist:4021853
Created November 6, 2012 01:25
Shell tips for Git
# initialize remote repositories for gitosis
su git
cd ~/repositories
mkdir SpringJMS.git
cd SpringJMS.git
git --bare init
@lvjian700
lvjian700 / gist:4030368
Created November 7, 2012 09:25
Ubuntu, add FTP task support for ant.
wget http://www.fayea.com/apache-mirror//commons/net/binaries/commons-net-3.1-bin.zip
unzip commons-net-3.1-bin.zip
sudo cp commons-net-3.1/commons-net-3.1.jar /usr/share/ant/lib/
rm -rf commons-net-3.1
rm -rf commons-net-3.1-bin.zip
@lvjian700
lvjian700 / gist:4537510
Created January 15, 2013 09:31
Ruby connect to FTP
require "net/ftp"
host = "ftp://192.168.1.42/"
begin
21ftp = Net::FTP.new
ftp.connect('192.168.1.42', 21)
ftp.login('***', '***')
status = ftp.status
#p status
files = ftp.list('*')
@lvjian700
lvjian700 / gist:5018859
Last active December 14, 2015 03:09
Objective C create 36 UUID
// generate 36 length UUID
// from: http://stackoverflow.com/questions/8684551/generate-a-uuid-string-with-arc-enabled
+ (NSString *)uuidString {
// Returns a UUID
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
NSString *uuidStr = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
CFRelease(uuid);
return uuidStr;
@lvjian700
lvjian700 / gitconfig.bat
Created May 6, 2013 03:23
Git basic config for Windows
@ECHO OFF
git config --global user.name "lvjian"
git config --global user.email "lvjian@dayang.com.cn"
echo 配置别名
git config --global alias.co "checkout"
git config --global alias.st "status"
git config --global alias.ci "commit"
echo 配置默认编辑器
@lvjian700
lvjian700 / new_gist_file
Created May 14, 2013 06:08
Using command line, Compile & Run Java App .
javac MainClass.java -cp "path/lib/*"
java -cp "path/lib/*" package.MainClass
@lvjian700
lvjian700 / build.xml
Created May 19, 2013 09:31
Compile Java Project include jar & doc
<?xml version="1.0" encoding="utf-8" ?>
<project name="uploadfile" default="compile" basedir=".">
<property name="src.dir" value="src/java" />
<property name="test.dir" value="src/test" />
<property name="res.dir" value="src/resources" />
<property name="bin.dir" value="bin" />
<property name="lib.dir" value="libs" />
<property name="doc.dir" value="doc" />
<property name="classes.dir" value="${bin.dir}/classes" />
@lvjian700
lvjian700 / new_gist_file
Created May 19, 2013 09:33
Custom UITableView & Cell backgroud color
#table
self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_window_landscape.png"]]
#Cell
UIView *backgrdView = [[UIView alloc] initWithFrame:cell.frame];
backgrdView.backgroundColor = [UIColor whiteColor];
cell.backgroundView = backgrdView;
@lvjian700
lvjian700 / new_gist_file
Created May 19, 2013 09:34
Setting UITableView selected row
NSIndexPath *indexSelected = [NSIndexPath indexPathForRow:index inSection:0];
[self tableView: self.taskTable willSelectRowAtIndexPath:indexSelected];
[self.taskTable selectRowAtIndexPath:indexSelected
animated:YES
scrollPosition:UITableViewScrollPositionMiddle];
[self tableView: self.taskTable didSelectRowAtIndexPath:indexSelected];