Skip to content

Instantly share code, notes, and snippets.

# ./config/database.yml is standard except specifying reaping_frequency
# adapter: postgresql
# database: all_products
# username: postgres
# host: localhost
# pool: 2
# reaping_frequency: 30
require 'rubygems'
require 'bundler/setup'
# Documentation: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# http://www.rubydoc.info/github/Homebrew/homebrew/master/frames
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Pdfsandwich < Formula
desc "A tool to make \"sandwich\" OCR pdf files"
homepage "http://www.tobias-elze.de/pdfsandwich/"
url "http://downloads.sourceforge.net/project/pdfsandwich/pdfsandwich%200.1.4/pdfsandwich-0.1.4.tar.bz2"
version "0.1.4"
sha256 "8b82f3ae08000c5cae1ff5a0f6537b0b563befef928e5198255b743a46714af3"
thebes $ brew install pdfsandwich
==> Downloading http://downloads.sourceforge.net/project/pdfsandwich/pdfsandwich%200.1.4/pdfsandwich-0.1.4.tar.bz2
Already downloaded: /Library/Caches/Homebrew/pdfsandwich-0.1.4.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/pdfsandwich/0.1.4
==> make install
mkdir -m 755 -p /usr/local/Cellar/pdfsandwich/0.1.4/bin /usr/local/Cellar/pdfsandwich/0.1.4/share/doc/pdfsandwich /usr/local/Cellar/pdfsandwich/0.1.4/share/man/man1
install -s pdfsandwich /usr/local/Cellar/pdfsandwich/0.1.4/bin
install: pdfsandwich: No such file or directory
make: *** [install] Error 71
(ns om-tutorial.core
(:require [goog.dom :as gdom]
[om.next :as om :refer-macros [defui]]
[om.dom :as dom]))
(enable-console-print!)
(defmulti read om/dispatch)
; this is a better version of my read function, where I should be able to supply a key by which to filter like parent-id e.g.
(ns foo-cart.core
(:require [goog.dom :as gdom]
[om.next :as om :refer-macros [defui]]
[om.dom :as dom]
[cljs.pprint :as pp]))
(enable-console-print!)
(defmulti read om/dispatch)
(defmulti mutate om/dispatch)
require 'concurrent'
require 'benchmark'
def process_sheets(sheets)
all_dependencies = Concurrent::Array.new
sheets.each_pair do |name, rows|
rows.each do |val|
all_dependencies.push(Concurrent::Future.execute {val*2})
end
#file_path = some excelx file with 6 sheets.....
## WITH DUP
roo = Roo::Spreadsheet.open file_path
jobs = Concurrent::Array.new
roo.each_with_pagename do |name, sheet|
local_sheet = sheet.dup
class Roo::Base
def each_sheet_concurrently(&block)
jobs = Concurrent::Array.new
self.sheets.each do |name|
jobs << Concurrent.future {
block.call(self.sheet(name))
}
end
Concurrent.zip(*jobs).value
@kshahkshah
kshahkshah / roo_with_concurrency.rb
Created October 13, 2016 18:20
Roo && concurrent-ruby
require 'concurrent'
require 'concurrent-edge'
# require 'benchmark'
# require 'pry'
# rails...
#require './config/environment'
class Roo::Base
def each_sheet_concurrently(&block)
SELECT value, id, similarity
FROM other_table
CROSS JOIN LATERAL (
SELECT similarity(master_table.value, other_table.value) as similarity
FROM master_table
ORDER BY similarity DESC
LIMIT 1
) l