Skip to content

Instantly share code, notes, and snippets.

View triangletodd's full-sized avatar

Todd Edwards triangletodd

View GitHub Profile
@triangletodd
triangletodd / 20000_leagues
Last active June 21, 2017 03:25
ASCII Art
__...__
.--""``` ```""--.
':--..___ ___..--:'
\ ``` /
.-` ___.....___ '-.
.:-""`` ~ ~ ``""-:.
/`-..___ ~ ~ ~___..-'\
/ ~ '`""-----""` \
; ;
; '::. ' .:' _. ;
@triangletodd
triangletodd / benchmark_bcrypt.rb
Created March 15, 2017 20:12
Benchmarking BCrypt
require 'benchmark'
require 'bcrypt'
(5..15).to_a.each do |i|
bm = Benchmark.measure { BCrypt::Password.create('I have a hairy cat', cost: i) }
puts "cost: #{i} \t #{bm}"
end
#=> cost: 5 0.010000 0.000000 0.010000 ( 0.001988)
#=> cost: 6 0.000000 0.000000 0.000000 ( 0.004081)
@triangletodd
triangletodd / currencies.yml
Created January 23, 2017 20:57
Currencies
---
- :code: AED
:description: UAE Dirham
:notes: "United Arab Emirates"
- :code: AFA
:description: Afghani
:notes: "Afghanistan. DEPRECATED, replaced by AFN"
- :code: AFN
:description: Afghani
:notes: "Afghanistan (prices normally quoted as integers)"
@triangletodd
triangletodd / yt
Last active January 5, 2017 20:28
Download and play youtube videos in mplayer with a single command.
#!/usr/bin/env bash
set -e
url="$1"
temp_dir=$(mktemp -d /tmp/yt.XXXXXXXXXXXXX)
validate_url() {
if [ -z $url ]; then
echo 'Usage: yt [url]'
exit 0
@triangletodd
triangletodd / benchmark_tr_vs_gsub.rb
Created September 23, 2016 20:33
Ruby tr vs. gsub
#!/usr/bin/env ruby
require 'benchmark/ips'
SLUG = 'writing-fast-ruby'
def slow
SLUG.gsub('-', ' ')
end
def fast
@triangletodd
triangletodd / keybase.md
Last active December 12, 2020 22:41
Keybase proof

Keybase proof

I hereby claim:

  • I am triangletodd on github.
  • I am triangletodd (https://keybase.io/triangletodd) on keybase.
  • I have a public key ASBIK4ohhlMTNaunJK6ta18ibDLO7SUNbJJrTswY9S9n8go

To claim this, I am signing this object:

@triangletodd
triangletodd / soma.rb
Last active December 12, 2020 22:42
Ruby SOMA.fm
#!/usr/bin/env ruby
$:.push(File.expand_path('../', __FILE__))
require 'soma_fm'
puts SomaFM.to_json
@triangletodd
triangletodd / whatthecommit.sorted.log
Last active December 12, 2020 22:41
What the Commit
- Temporary commit.
#GrammarNazi
(\ /)<br/>(O.o)<br/>(&gt; &lt;) Bunny approves these changes.
(c) Microsoft 1988
-m \'So I hear you like commits ...\'
.
...
/sigh
640K ought to be enough for anybody
8==========D
@triangletodd
triangletodd / debugging_ios_uiautomation.js
Last active December 12, 2020 22:44
IOS UIAutomation Debugging
function dumpElementTree() {
UIALogger.logStart("Logging element tree ...");
UIATarget.localTarget().logElementTree();
UIALogger.logPass();
}
function inspect(obj) {
var log = UIALogger;
var methods = [];
@triangletodd
triangletodd / gdrive_to_yml.rb
Last active December 12, 2020 22:43
GDrive to YAML
#!/usr/bin/env ruby
require 'pry'
require 'yaml'
require 'google_drive'
GDRIVE_USER = ENV['GDRIVE_USER'] || raise('Please set the GDRIVE_USER environment variable')
GDRIVE_PASS = ENV['GDRIVE_PASS'] || raise('Please set the GDRIVE_USER environment variable')
YML_FILE = 'apple_app_info.yml'
data = {}