This file contains hidden or 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
| Dir.glob(“#{dir_path}/*").map{|x| File.basename(x, '.xlsx') } |
This file contains hidden or 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
| var _ = require('lodash'); | |
| results_2009 = [ | |
| { ap:42, inc:33, bjp:0, trs:2, tdp:6, others:1 }, | |
| { ar:2, inc:2, bjp:0, others:0 }, | |
| { as:14, inc:7, bjp:4, others:3 } | |
| ]; | |
| var result_1 = _.map( results_2009 , function (result) { return _.values(result); }); | |
| var result_2 = _.flatten(_.map( results_2009 , function (result) { return _.values(result); })); | |
| console.log("result_1",'\n', result_1); |
This file contains hidden or 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
| require 'rubygems' | |
| require 'active_support/all' | |
| restaurants = [ "name 1", | |
| "Karachi's", | |
| "Kai D", | |
| "Kaar- on ()", | |
| "KaracDarbar", | |
| ] |
This file contains hidden or 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
| require 'fileutils' | |
| (0..99).each do |p| | |
| p_name = 'klhcc' + (p * 1000).to_s.rjust(5, '00000') | |
| FileUtils.mkdir_p (0..99).map{ |c| "#{p_name}/klhcc" + (p * 1000 + c * 100).to_s.rjust(5, '00000') } | |
| end | |
| Dir.glob("*.md") do |file| | |
| filename = File.basename(file, '.md') | |
| pf = 'klhcc' + "#{filename.chop.chop.chop}000".rjust(5, '00000') |
This file contains hidden or 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
| require 'nokogiri' | |
| Dir.foreach('/Users/geordee/Projects/Data') do |filename| | |
| next if filename == '.' or filename == '..' | |
| puts "Processing #{filename}" | |
| fin = File.open(filename, "r") | |
| html = Nokogiri::HTML(fin) | |
| textarea = html.search("//textarea") |
This file contains hidden or 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
| qpdf --linearize input.pdf output.pdf |
This file contains hidden or 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
| http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html | |
| http://ruby-doc.org/downloads/ |
This file contains hidden or 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
| case a | |
| when 1 | |
| puts "Single value" | |
| when 2, 3 | |
| puts "One of comma-separated values" | |
| when 4..6 | |
| puts "One of 4, 5, 6" | |
| when 7...9 | |
| puts "One of 7, 8, but not 9" | |
| when 1..4, 5 |
This file contains hidden or 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
| https://ruby-hacking-guide.github.io/thread.html | |
| http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Method_Calls | |
| http://ruby-doc.com/docs/ProgrammingRuby/html/tut_methods.html | |
| http://rubymonk.com/learning/books/1-ruby-primer/chapters/19-ruby-methods/lessons/69-new-lesson | |
| http://rubyfiddle.com/ => run ruby scrips in the browser |
This file contains hidden or 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
| http://ruby-doc.org/stdlib-2.1.1/libdoc/optparse/rdoc/OptionParser.html |
OlderNewer