Skip to content

Instantly share code, notes, and snippets.

@bash0C7
bash0C7 / WorkLogger.vbs
Created January 2, 2012 00:15
WorkLogger.vbs
'1 line ver
CreateObject("Scripting.FileSystemObject").OpenTextFile(CreateObject("Scripting.FileSystemObject").BuildPath(CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName), "worklog_" & WScript.CreateObject("WScript.Network").ComputerName & ".txt"), 8, True).WriteLine date & vbtab & time & vbTab & InputBox("Comment", WScript.ScriptName)
'3 line ver
With CreateObject("Scripting.FileSystemObject")
.OpenTextFile(.BuildPath(.GetParentFolderName(WScript.ScriptFullName), "worklog_" & WScript.CreateObject("WScript.Network").ComputerName & ".txt"), 8, True).WriteLine date & vbtab & time & vbTab & InputBox("Comment", WScript.ScriptName)
End With
'4 line (basic)
With CreateObject("Scripting.FileSystemObject")
@bash0C7
bash0C7 / gist:1548764
Created January 2, 2012 00:20
ExcelDataRecord.cls
Option Explicit
Private MainKeyCol As Long
Private RowCounter As Long
Private Source As Workbook
Private isReadOnly As Boolean
Property Get EOF() As Boolean
@bash0C7
bash0C7 / gist:1548791
Created January 2, 2012 00:28
num↔hex functions
Public Function convNUMtoHEX(Number As Long) As String
convNUMtoHEX = CStr(Hex(Number))
End Function
Public Function convHEXtoNUM(HexString As String) As Long
Const HEXMARK = "&H"
Const UNSIGN = "&"
convHEXtoNUM = Val(HEXMARK & HexString & UNSIGN)
End Function
@bash0C7
bash0C7 / dsrsh.rb
Created January 9, 2012 13:43
Redmine Client Ruby REPL
# -*- coding: utf-8 -*-
abort if ARGV.empty?
initializer = ARGV.shift
eval(File.read(initializer), binding)
prompt_prefix = File.basename(initializer)
require 'rubygems'
require 'pry'
pry(prompt_prefix)
@bash0C7
bash0C7 / rails_best_practices.rake
Created May 19, 2012 13:01 — forked from holysugar/rbp-to-jenkins-plot.sh
exec rails_best_practices on "rails3 rake" for jenkins plot plugin
namespace :rails_best_practices do
desc "run rails best practices"
task :jenkins_plot_plugin => :environment do
cd Rails.root do
OUTDIR = "#{Rails.root}/reports"
mkdir OUTDIR unless FileTest.exist? OUTDIR
OUTFILE = "#{OUTDIR}/rails_best_practices.properties"
@bash0C7
bash0C7 / rails_best_practices.rake
Created May 19, 2012 13:03 — forked from holysugar/rbp-to-jenkins-plot.sh
exec rails_best_practices on "padrino rake" for jenkins plot plugin
namespace :rails_best_practices do
desc "run rails best practices"
task :jenkins_plot_plugin => :environment do
cd Padrino.root do
OUTDIR = "#{Padrino.root}/reports"
mkdir OUTDIR unless FileTest.exist? OUTDIR
OUTFILE = "#{OUTDIR}/rails_best_practices.properties"
@bash0C7
bash0C7 / gist:2856738
Created June 2, 2012 05:21
#minatork01 pink-one(sakurai & koshiba)
# -*- coding: utf-8
require 'pry'
class Fixnum
def numerals
if self < 20
case self
when 0
'zero'
when 1
@bash0C7
bash0C7 / rails_new.sh
Created June 2, 2012 06:01
install rails and run rails new
#!/bin/bash
if [ $# -ne 1 ]; then
echo "引数1にrailsアプリ名を入れて下さい" 1>&2
exit 1
fi
cat << EOS > Gemfile
source "http://rubygems.org"
gem "rails", "3.2"
@bash0C7
bash0C7 / padrino_new.sh
Created June 2, 2012 06:02
install padrino and run padrino generate project
#!/bin/bash
if [ $# -ne 2 ]; then
echo "引数1にpadrinoプロジェクト名を入れて下さい" 1>&2
echo "引数2にpadrinoコアアプリケーション名を入れて下さい" 1>&2
exit 1
fi
cat << EOS > Gemfile
source "http://rubygems.org"
@bash0C7
bash0C7 / gist:4010438
Created November 4, 2012 05:32
scrape(Webrat)
# -*- coding: utf-8 -*-
require 'mechanize'
require 'webrat'
require 'pry'
Webrat.configure do |config|
config.mode = :mechanize
end