Skip to content

Instantly share code, notes, and snippets.

@komasaru
komasaru / ecef2blh.rb
Created February 24, 2019 04:16
Ruby script to convert ECEF to WGS84(BLH) coordinate.
#! /usr/local/bin/ruby
#---------------------------------------------------------------------------------
# ECEF -> BLH 変換
# : ECEF(Earth Centered Earth Fixed; 地球中心・地球固定直交座標系)座標を
# WGS84 の緯度(Latitude)/経度(Longitude)/楕円体高(Height)に変換する。
#
# Date Author Version
# 2019.02.19 mk-mode.com 1.00 新規作成
#
# Copyright(C) 2019 mk-mode.com All Rights Reserved.
@danielpowell4
danielpowell4 / google_sheet_report_writer.rb
Last active November 15, 2023 11:37
Write reports straight to google sheets! We use this in our Rails app to run queries and share the data outside the app.
require 'google/apis/sheets_v4'
require 'google/apis/drive_v3'
require 'googleauth'
require 'fileutils'
class GoogleSheetReportWriter
def initialize(notification_email:)
@creds = build_credentials
@notification_email = notification_email
end
@Nakilon
Nakilon / news.md
Last active July 27, 2021 02:17
The most important (in my opinion) changes in Ruby versions

N -- new feature -- I may consider using it
B -- breaking change -- I should review my code

N def-expr now returns the symbol of its name instead of nil.
N Array#to_h converts an array of key-value pairs into a Hash.
N Enumerable#to_h converts a list of key-value pairs into a Hash.
N Binding#local_variable_get(symbol)
N Exception#cause provides the previous exception which has been caught at where raising the new exception.
@kentbrew
kentbrew / lang_chrome_osx.md
Last active May 3, 2024 06:45
How to change the Chrome default language on OSX

How to Change your Chrome Default Language

Open up a Terminal window. (If you have never seen Terminal before, go to Spotlight Search and type "Terminal.")

In the Terminal box, try this:

defaults read com.google.Chrome AppleLanguages

If you see this:

The Story of NPM and Yarn

In the beginning there was NPM, and for a time it was good. Packages went forth and multiplied. The New Gods proclaimed the great demon Dependency Management had been slain. But The Old Gods knew better, for they had seen much and knew that the demon can never be killed, only held at bay.

The Old Gods were ignored. In the folly of a young age grew an abundance of packages and with them grew the scourge of dependency. In the depths beneath the earth, in a place beyond memory, the great demon stirred.

The first sign something was wrong was non-deterministic package version mismatches. “This is fine!” The New Gods declared. “A temporary setback, nothing more! We can fix it.” And so they introduced shrinkwrap, a lamp to combat the growing darkness.

But it proved to be too little, too late, and dusk continued to fall. The New Gods suffered their first major defeat at the [Battle of Left-pad](https://www.theregister.co.uk/2016/03/23/npm_left_

@am-kantox
am-kantox / digest_benchmark.rb
Created March 29, 2017 14:28
Ruby :: benchmark of different digests
require 'benchmark/ips'
n = 500000
require 'digest/md5'
require 'digest/sha1'
require 'digest/sha2'
require 'digest/sha3' # https://github.com/phusion/digest-sha3-ruby
INPUT = [5, "Hello, world", nil]
@baweaver
baweaver / ruby_books.md
Last active April 24, 2024 19:24
A list of books for learning and expanding on your Ruby knowledge.

Ruby Book List

Learning Ruby

You're taking your first steps into Ruby

A good introduction to programming in general. Easy on newer programmers.

@spalladino
spalladino / Makefile
Created November 23, 2016 15:40
Proof of concept of Ruby extension written in Crystal
testruby.bundle: testruby.cr
crystal testruby.cr --link-flags "-dynamic -bundle -Wl,-undefined,dynamic_lookup" -o testruby.bundle
irb: testruby.bundle
irb -rtestruby -I.
clean:
rm -rf .crystal testruby.bundle
@vielhuber
vielhuber / _1.MD
Last active September 22, 2023 14:28
image optimization compression (jpg, png, gif, svg) for google page speed / progressive jpgs svgo #windows #linux

notes

  • use the latest version of the following tools (build them from source)
  • i spent a lot of time comparing and finally got to these final tools

jpg (lossless)

find . -iregex '.*\.\(jpg\|jpeg\)$' -type f -exec mozjpeg -copy none -optimize -progressive -outfile {} -verbose {} \;

jpg (lossy)

Oga vs Nokogiri

Benchmark Results

Warming up --------------------------------------
          oga.simple   503.000  i/100ms
           oga.xpath   677.000  i/100ms
             oga.css   783.000  i/100ms
     nokogiri.simple   450.000  i/100ms
      nokogiri.xpath   145.000  i/100ms