Skip to content

Instantly share code, notes, and snippets.

View cisolarix's full-sized avatar
🌻
Cool

Yanming Deng cisolarix

🌻
Cool
View GitHub Profile
@cisolarix
cisolarix / git related command alias
Created October 26, 2014 01:38
git related command alias
@cisolarix
cisolarix / github flow.md
Last active August 29, 2015 14:02
Github workflow for your information

如果要开发新的特性,要在新的分支上进行开发

  • git branch 显示本地所有分支

  • git branch -a 显示本地以及远端所有分支

  • git log 显示本地的 commit 历史记录

@cisolarix
cisolarix / increment_numbers_in_filename
Created March 2, 2014 01:51
incrementing numbers in all files within a directory
require 'find'
require 'fileutils'
Find.find(ENV["HOME"] + "/Movies/backup") do |path|
if FileTest.file? path
if path =~ /(\d+)/
old_num = $1
new_num = old_num.to_i + 1
new_path = path.gsub( old_num, new_num.to_s )
puts "renaming #{path} to #{new_path}\n"
@cisolarix
cisolarix / SPL_delete_dir.php
Created July 26, 2012 03:51
recursively deleting directory with sub-directories and files using SPL in PHP
function recursiveDelDirecoty( $dir, $delMe = FALSE ) {
$dir = realpath( $dir );
try{
$it = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $dir, RecursiveDirectoryIterator::SKIP_DOTS ), RecursiveIteratorIterator::CHILD_FIRST );
foreach( $it as $i ) {
if ( $i->isDir() ) {
rmdir( $i->getRealPath() );
echo "删除". $i . "目录成功";
}else{
unlink( $i->getRealPath() );