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
1 require 'spreadsheet' | |
# Open workbooks | |
current_workbook = Spreadsheet.open('jan.xls') | |
total_workbook = Spreadsheet.open('output.xls') | |
# Process xls | |
# Iterate through workbook spreadsheets | |
current_workbook.worksheets.each_with_index do |current_spreadsheet, spreadsheet_index| | |
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
# Sinatrize | |
# usage: | |
# | |
# mkdir -p yourapp | |
# cd yourapp | |
# wget https://gist.githubusercontent.com/makevoid/2385559/raw/1fc0355a04ed2153d74b06386048d1e1541a0706/sinatrize.rb # if you are not sure get the latest gist by clicking on [Raw] | |
# ruby sinatrize.rb | |
# rm -f sinatrize.rb | |
# bundle |
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
source "http://rubygems.org" | |
gem 'sinatra' | |
gem 'sinatra-jsonp' |
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
# | |
# Jekyll Generator for SCSS | |
# | |
# (File paths in this description relative to jekyll project root directory) | |
# Place this file in ./_plugins | |
# Place .scss files in ./_scss | |
# Compiles .scss files in ./_scss to .css files in whatever directory you indicated in your config | |
# Config file placed in ./_sass/config.rb | |
# |
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
# I used this to monitor changes to the .git folder during | |
# my Austin on Rails lightning talk on Understanding Git. | |
# | |
# I ignore any changes to the .git/logs folder, because they are | |
# noisy and don't add a lot to understanding. | |
# If you want "the whole truth", remove the :ignore parameter below. | |
# | |
# ruby listen.rb <path to .git folder> | |
# | |
# gem install listen # its the foundation of Guard |
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 | |
require 'pdf-reader' | |
infile=ARGV[0] | |
outfile=ARGV[1] | |
reader = PDF::Reader.new(infile) | |
text = "" | |
reader.pages.each do |page| |
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
string = ARGV.first | |
string = string.gsub(/\n/,"\\n") | |
file = File.new("output.txt", "w") | |
file.write(string) | |
file.close |
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
brew remove mysql | |
brew cleanup | |
launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist | |
rm ~/Library/LaunchAgents/com.mysql.mysqld.plist | |
sudo rm -rf /usr/local/var/mysql |
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
# Simplest possible marimekko/mosaic plot | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("vcd", "ggplot2", "RColorBrewer") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
theme_set(theme_gray(base_size = 7)) | |
# All you need to start with is individual count data, and a grouping variable |
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
# encoding: UTF-8 | |
require 'uri' | |
require 'feedzirra' | |
require 'open-uri' | |
class LivefeedController < ApplicationController | |
def livefeed | |
q = '宏達電' | |
url = URI.escape("https://news.google.com/news/feeds?q="+q+"&output=rss&num=90") | |