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
# inspired by http://stackoverflow.com/questions/1530324/ruby-xml-to-json-converter | |
require 'json' | |
require 'active_support/core_ext/hash' | |
STDOUT.write(JSON.pretty_generate(Hash.from_xml(ARGF.read))) |
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
ruby -ryaml -rpp -e "pp YAML.load(STDIN)" < infile > outfile |
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
ruby -rjson -e "STDOUT.write JSON.pretty_generate(JSON.load(STDIN))" < infile > outfile |
- [37Signals](http://37signals.com/svn/posts/3167-code-spelunking-in-the-all-new-basecamp (switchen van Solr)
- Github
- StackOverflow
- Kickstarter
- Foursquare
- Lonely Planet
- Quora
- Soundcloud
- Mozilla (Buildbot)
- [Mozilla (Metrics)](http://
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
# config/application.rb | |
require File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
Bundler.require(:default, Rails.env) | |
module MyApp | |
class Application < Rails::Application | |
# configure Rails to inject this middleware. Must be at least after Rails logger! |
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
# it's best to depend on trunk of MiniProfiler, e.g. due to the issue I had with | |
# graphs not showing up over HTTPS which is fixed in | |
# https://github.com/SamSaffron/MiniProfiler/commit/831b917e70d57bc3c03858c46b3c5828f73e3f35 | |
gem 'rack-mini-profiler', git: 'git://github.com/SamSaffron/MiniProfiler.git' |
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
ruby -rnokogiri -ropen-uri -e 'puts Nokogiri::XML(open("http://www.w3schools.com/xml/note.xml")).xpath("//text()").to_s' |
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
open <hostname> | |
<user> | |
<pass> | |
binary | |
put <filename> | |
quit |
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
# change filenames, replacing "fgh" by "abc" | |
for f in fgh*; do mv "$f" "${f/fgh/abc}";done |
NewerOlder