Skip to content

Instantly share code, notes, and snippets.

@vigetlabs
vigetlabs / statham_sanitizer.rb
Created November 23, 2009 15:06
HTML::StathamSanitizer
module HTML
class StathamSanitizer < WhiteListSanitizer
protected
def tokenize(text, options)
super.map do |token|
if token.is_a?(HTML::Tag) && options[:parent].include?(token.name)
token.to_s.gsub(/</, "&lt;")
else
@nobuoka
nobuoka / commit-built-files-to-gh-pages-branch.markdown
Last active November 22, 2019 15:38
The way to commit built files in subdirectory to gh-pages branch from an arbitrary branch

Committing a subfolder to the gh-pages branch from the other branch

Sometimes you want to commit a subfolder on an arbitrary branch (rather than gh-pages branch) as the root directory to the gh-pages branch. You will want to do so when, for example, the files to be published on GitHub Pages are generated by a build system.

This document shows the way to commit a build/gh-pages directory to the gh-pages branch by using Git plumbing commands. In the following example, Windows PowerShell is used as a shell environment.

Step 1 : Create a tree object

How To Start Twitter Botting -- The Boring Parts

The boring parts of standing up a twitter bot I always forget. This guide should get you from "I got absolutely nothing" to "I posted a thing to twitter with Python!"

Here's the deal. If you make a bunch of bot accounts, and all those accounts are tied to one cell phone number, you are in for a round of API access recovation musical chairs.

To get around this, you need to create your own central twitter app. This app will in turn then be used by all your bot accounts. This app will be tied to your main account, backed by your phone number.

1. Create a Twitter Dev Account

@itsanov
itsanov / fix_sketchup_wine.rb
Last active July 14, 2023 11:33 — forked from DSDev-NickHogle/fix_sketchup_wine.rb
Helps fix the one-frame delay problem when running Google Sketchup in Wine
# Fixes the view each time the view changes
require 'sketchup'
def refresh
UI.start_timer(0, false) {
Sketchup.active_model.active_view.invalidate.refresh
}
end