Skip to content

Instantly share code, notes, and snippets.

View gr8bit's full-sized avatar

Niklas Bichinger gr8bit

  • Bichinger Software & Consulting
  • Germany
  • 03:59 (UTC +02:00)
View GitHub Profile
@gr8bit
gr8bit / robinson.js
Created April 6, 2018 13:02
Robinson projection in JavaScript
// Robinson projection calculation
// Written by Niklas Bichinger (bichinger.de). This code is Public Domain - use as you like.
// source of robinson numbers: https://simplemaps.com/static/img/flash/robinson_projection_table.jpg
var robinsonAA = [
0.84870000,
0.84751182,
0.84479598,
0.84021300,
@gr8bit
gr8bit / fix_sql_administrator_csv.rb
Last active March 10, 2023 06:34
When exporting CSV with the Microsoft SQL Administrator tool, it generates somewhat invalid CSV which cannot be parsed through regular libraries. This ruby-tool reads these files and converts them into valid CSV, keeping encoding, seperators, and linebreaks from the original file. Run "ruby fix_sql_administrator_csv.rb" for info.
require 'csv'
class MSSQLAdministratorCSVParser
QUOTE = '"'
ESCAPE = '"'
SEPARATORS = %W(; , \t) # when equally probable, separatur occurring first is being picked
UTF8_BOM = "\xef\xbb\xbf".force_encoding('ASCII-8BIT')
def initialize(file_name, options={})