This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
.spoiler-hidden { background-color: gray; color: gray; cursor: pointer; } | |
</style> | |
</head> | |
<body> | |
<p class="spoiler">CONTENT FLAGS: Clowns, Rich People, Extended Sounds Of Brutal Pipe Murder</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# percent(55, 556) | |
# => "09.89%" | |
def progress_as_percentage(i, total) | |
"%05.2f%%" % (100.0*i/total) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faraday' | |
# Valid formats: html, doc, docx, epub, odt, pdf, txt | |
def get_doc_as(doc_id, type='html') | |
Faraday.get("https://docs.google.com/document/d/#{doc_id}/export?format=#{type}").body | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# How-to: | |
# bash rand_str.bash {{optional length}} | |
# Source: https://www.tldp.org/LDP/abs/html/string-manipulation.html | |
LEN=$1 | |
if [ -z $LEN ]; then LEN=8; fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
# (Unless you are the person I am sending this to, you do not need it.) | |
# | |
# Steps to use: | |
# 1. Export a Google Docs file to HTML. | |
# 2. Unzip the HTML file and put the filename below. | |
# 3. Edit css_pass (further down) to correctly convert 'c{SOME NUMBER}'-class elements to <i>, <b>, or <u>. | |
# 4. Run cleanup() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'unicode/emoji' | |
require 'gemoji' | |
# Replaces all emoji within a string with ":#{NAME_OF_EMOJI}:" | |
# Ex: "here's a sheep emoji 🐑" | |
# => "here's a sheep emoji :sheep:" | |
def replace_emoji(str) | |
str.scan(Unicode::Emoji::REGEX).each do |emoji| | |
emoji_name = Emoji.find_by_unicode(emoji).name | |
puts "#{emoji} => #{emoji_name}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
<https://stackoverflow.com/questions/40296831/is-it-possible-to-force-a-copy-of-a-protected-google-doc> | |
NOTE - 2021-05-24 | |
----------------- | |
The script below isn't the fastest way to copy-and-paste from a protected | |
Google Doc. Before trying it, I'd suggest following MikoFrosty's advice from | |
the comments: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'oga' | |
# Scrapes an HTML string for image URLs using Oga + regex. | |
class HtmlImageUrlScraper | |
EXTNAMES = ['.jpeg','.jpg','.gif','.png','.bmp','.svg','.tif','.tiff','.ai','.apng','.bpg','.cgm','.dxf','.eps','.flif','.hdp','.hdr','.heic','.heif','.ico','.iff','.jp2','.jpx','.jxr','.lbm','.pbm','.pgm','.pnm','.ppm','.wdp','.webp'] | |
attr_accessor :extnames, :regexes | |
def initialize(extnames: EXTNAMES, regexes: nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tumblr_client' | |
require 'fileutils' | |
require 'yaml' | |
@client = Tumblr::Client.new({ | |
:consumer_key => "FILL", | |
:consumer_secret => "THESE", | |
:oauth_token => "FIELDS", | |
:oauth_token_secret => "IN" | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'sinatra', '~> 1.4.7' | |
require 'sinatra' | |
gem 'omniauth-tumblr', '~> 1.2' | |
require 'omniauth-tumblr' | |
gem 'tumblr_client', '~> 0.8.5' | |
require 'tumblr_client' | |
require 'yaml' | |
# omniauth-tumblr + tumblr_client + sinatra Example |