Skip to content

Instantly share code, notes, and snippets.

@chikadance
chikadance / tool.rb
Created April 6, 2013 03:20
Get lastest filename
class Tool
def get_lastest()
Dir.glob("**/**/*.rb") do |filename|
puts "filename: #{filename},atime:#{File.stat(filename).atime}"
end
# get filename with most access time ##!! use min, but max
Dir.glob("**/**/*.rb").sort { |a, b| File.stat(a).atime <=> File.stat(b).atime }.min
end
end
@chikadance
chikadance / Rakefile
Created April 6, 2013 03:25
rake run lastest_file
require_relative "./ex_tool/lib/tool"
task :default => [:test]
task :test do
sh "bundle exec ruby ./ex/watir.rb"
end
task :la do
#ARGV[1] represents argument which you input.
require "rubygems"
require "thor"
class ThorExample < Thor
desc "start", "start sever"
method_option :environment, :default => "development", :aliases => "-e",
:desc => "which environment you want server run."
method_option :daemon, :type => :boolean, :default => false, :aliases => "-d",
:desc => "running on daemon mode?"
def start
@chikadance
chikadance / def_block.rb
Created April 6, 2013 13:11
ruby yield block
def method1
yield
end
method1 { puts 1+1 }
@chikadance
chikadance / style_2.scss
Created April 8, 2013 02:11
test sublime gist
.wrap {
width: 600px;
margin: auto;
}
.content {
background: red;
float: left;
width: 450px;
}
@chikadance
chikadance / style_2.scss
Created April 8, 2013 11:10
css layout
@mixin size_col($width: auto, $height: auto, $background: #e3e3e3) {
width: $width;
height: $height;
background: $background;
}
.wrap {
min-width: 600px;
@include size_col(80%, auto, green);
margin: auto;
@chikadance
chikadance / Rakefile
Created April 9, 2013 09:21
rakefile for web ex
require "fileutils"
task :default => [:new_web_proj]
task :new_web_proj => [:precheck, :clear, :js, :img, :css, :create_index,
:open_scss_watch]
task :precheck do
if Dir.glob("**") != ["Rakefile"]
puts "This Proj is not empty, Are you sure to delete all and rebuild a new
@chikadance
chikadance / set_alias.rb
Created April 18, 2013 01:17
bash-like alias
$file_path = 'd:/360cloud/tool/alias.psm1'
class Set_Alias
def create
p 'create'
file = File.new($file_path, 'a')
file.puts
file.puts "Function #{@ali} { #{@ori} }"
file.close
end
@chikadance
chikadance / gist:6606283
Created September 18, 2013 08:34
091813work
Dim ply As MapObjects2.Polygon
Dim rect As MapObjects2.Rectangle
'The DragRect sample implements a locator map that displays the
'current extent of a larger, main map in the same form.
'In addition, when the user clicks in the rectangle of the locator map,
'it can be dragged to a new location, forcing a change to the main map.
Dim g_feedback As DragFeedBack
@chikadance
chikadance / gist:6657261
Created September 22, 2013 06:30
sudo grep -ir firefox /etc
/etc/fonts/conf.avail/90-synthetic.conf: needed for applications using Xft directly, e.g. Firefox, ...
/etc/mono/browscap.ini:[Mozilla/5.0 (SnapPreviewBot) Gecko/* Firefox/*]
/etc/mono/browscap.ini:[Mozilla/5.0 (Windows; U; Windows *; *; rv:*) Gecko/* Firefox/* webaroo/*]
/etc/mono/browscap.ini:[Mozilla/5.0 (Macintosh; U; *Mac OS X*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]
/etc/mono/browscap.ini:[Mozilla/5.0 (Windows; U; Win 9x 4.90; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]
/etc/mono/browscap.ini:[Mozilla/5.0 (Windows; U; Windows NT 5.0*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]
/etc/mono/browscap.ini:[Mozilla/5.0 (Windows; U; Windows NT 5.1*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]
/etc/mono/browscap.ini:[Mozilla/5.0 (Windows; U; Windows NT 5.2*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]
/etc/mono/browscap.ini:[Mozilla/5.0 (Windows; U; Windows NT 6.0*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]
/etc/mono/browscap.ini:[Mozilla/5.0 (Windows; U; Windows NT 6.1*; *; rv:1.*) Gecko/* Firefox/2.* Flock/1.*]