Skip to content

Instantly share code, notes, and snippets.

@banzera
banzera / filtered zip.rb
Created November 21, 2019 15:52
filtered zip
FILTER_FILES_REGEX = [
/Thumbs\.db/, # omit OSX thumbs
/\~\$/, # omit temp office files
/\/\z/, # omit directories
]
def download_file_edition_and_add_to_zip(file_edition, dst_zip)
open(file_edition.download_url) do |tf|
if file_edition.download_file_name.ends_with?('.zip')
Rails.logger.debug "Unpacking file edition: #{file_edition.download_file_name}"
@banzera
banzera / filtered_zips.rb
Created November 21, 2019 03:13
filtered_zips
FILTER_FILES_REGEX = [
/Thumbs\.db/, # omit OSX thumbs
/\~\$/, # omit temp office files
/\/\z/, # omit directories
]
def filtered_paths(zip)
zip.paths.delete_if do |path|
FILTER_FILES_REGEX.any?{|regex| regex === path}
end
FILTER_FILES_REGEX = [
/Thumbs\.db/, # omit OSX thumbs
/\~\$/, # omit temp office files
/\/\z/, # omit directories
]
def filtered_paths(zip)
zip.paths.delete_if do |path|
FILTER_FILES_REGEX.any?{|regex| regex === path}
end
@banzera
banzera / app.js
Created March 7, 2017 20:51 — forked from devjin0617/app.js
Sample Trello node.js Webhook Server
/**
* This is a sample webhook server that listens for webhook
* callbacks coming from Trello, and updates any cards that are
* added or modified so everyone knows they are "PRIORITY"
*
* To get started
* * Add your key and token below
* * Install dependencies via `npm install express request body-parser`
* * Run `node app.js` on a publicly visible IP
* * Register your webhook and point to http://<ip or domain>:3123/priority
import org.apache.poi.ss.usermodel.*
import org.apache.poi.hssf.usermodel.*
import org.apache.poi.xssf.usermodel.*
import org.apache.poi.ss.util.*
import org.apache.poi.ss.usermodel.*
import java.io.*
class GroovyExcelParser {
//http://poi.apache.org/spreadsheet/quick-guide.html#Iterator