Skip to content

Instantly share code, notes, and snippets.

@rwoeber
rwoeber / rot13.rb
Created January 11, 2010 10:09
Ruby rot13
# or simply:
'foobar'.tr 'A-Za-z','N-ZA-Mn-za-m'
# rot(x)
class String
def rot(num = 13)
return self.split("").collect { |ch|
if /^[a-z]$/ === ch
((ch[0] + num - 'a'[0]) % 26 + 'a'[0]).chr
@cyle
cyle / npf_tumblr_theme.html
Last active November 26, 2021 17:35
NPF powered tumblr theme prototype
<!--
Note that this is a very rough, incomplete prototype.
More info on how to possibly leverage it here: https://github.com/tumblr/docs/issues/49
-->
<!DOCTYPE html>
<html>
<head>
{MobileAppHeaders}
@Snarp
Snarp / extract_youtube_closed_captions.rb
Created June 14, 2020 14:43
Extracts all UTF-8 strings from YouTube's closed caption ("timedtext") JSON object to generate a rough transcript.
require 'json'
# Extracts all UTF-8 strings from YouTube's closed caption (`timedtext`) JSON
# object to generate a rough transcript.
#
# Instructions for acquiring the JSON:
#
# 1. Open the video in a new Firefox tab. Don't click "CC" yet.
#
# 2. Open Firefox Developer Tools (right-click somewhere and select "Inspect