This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# extract text node from xml file | |
# USAGE: | |
# xmltext.rb file_path xpath | |
require "rexml/document" | |
file = ARGV.shift.dup | |
xpath = ARGV.shift.dup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// access nested hash data using string | |
// Usage: | |
// var hash = {"foo": {"bar": true, "baz": false }}; | |
// getVal(hash, "foo.bar".split(".")); //=> true | |
// getVal(hash, "foo.baz".split(".")); //=> false | |
// setVal(hash, "foo.baz".split("."), "hoge"); //=> "hoge" | |
// you can also create new keys step by step (same as accessing with array-style) | |
function getVal(hash, keys) { | |
var frst=keys.splice(0,1); | |
if(keys.length) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#hoard.sh: Private twitter on the shell | |
#usage: | |
# hoard "some string here": for store your hoard into file | |
# hoard -s: hoard: for See your recent hoard | |
# hoard -e: for Edit your recent hoard | |
#Change these lines for your System. | |
hoarddir="/Users/$USER/Documents/Hoard/" | |
hoardfile="`date +%Y%m`.txt" |
NewerOlder