Skip to content

Instantly share code, notes, and snippets.

@rogerhub
rogerhub / example.xml
Created February 9, 2014 01:35
An example import for Disqus.
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="http://www.disqus.com/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
<channel>
<item>
<!-- title of article -->
@rogerhub
rogerhub / youtube-ratings-preview-addon-sdk-diff
Last active January 3, 2016 18:09
A full list of differences between the official Mozilla Jetpack Firefox Addons SDK version 1.14 (legacy) and the Addons SDK bundled with the Youtube Ratings Preview Addon for Firefox.
./windows/tabs-fennec.js
11c11,12
< const { openTab, getTabs, getSelectedTab, getTabForBrowser: getRawTabForBrowser } = require('../tabs/utils');
---
> const { openTab, getTabs, getSelectedTab, getTabForBrowser: getRawTabForBrowser,
> getTabContentWindow } = require('../tabs/utils');
21,22c22,23
< const { isPrivateBrowsingSupported } = require('sdk/self');
< const { isTabPBSupported } = require('sdk/private-browsing/utils');
---
@rogerhub
rogerhub / edmonds.py
Created January 9, 2014 22:16
An implementation of Edmond's Blossom Algorithm.
#!/usr/bin/env python
class Vertex:
def __init__(self, value):
self.value = value
self.edges = {}
def degree(self):
return len(self.edges)
def __str__(self):
return str(self.value)
@rogerhub
rogerhub / monthname.php
Created January 7, 2014 21:03
Enables the %monthcode% and %monthname% tag for permalinks in WordPress.
<?php
/**
* Plugin Name: Month Name
* Description: Enables the <code>%monthcode%</code> and <code>%monthname%</code> tag for Permalinks.
* Author: Roger Chen
* License: GPLv2
*/
/**
* Enables use of monthname (january, june) and monthcode (jan, jun).
@rogerhub
rogerhub / airbearsautologin.java
Created March 12, 2013 04:25
AirBears Automatic Login in Java
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.regex.*;
class AirBearsAutoLogin {
// Published URLs that SHOULD not change.
public static String google = "http://www.google.com/generate_204";
public static String airbears = "https://wlan.berkeley.edu/cgi-bin/login/calnet.cgi";
@rogerhub
rogerhub / gist:4761345
Created February 12, 2013 10:06
Latest parsecss function
roger@melchior [~/Staging/main-theme]$ php5 -a
Interactive shell
php > include("colors.php");
php > print_r(DC_Colors::parsecss('rgba(32, 51, 41, 0.3)'));
Array
(
[0] => 32
[1] => 51
[2] => 41
@rogerhub
rogerhub / password_gen.rb
Created September 27, 2011 01:58
Password generator for Clark w/ default salt built in
require 'digest/sha2'
adjectives = %w[red orange blue green purple big small wide thin gray long dark high low white smooth cool hot dusty sticky furry nice mean rich poor yellow sad happy ]
nouns = %w[book ruler kleenex glasses wand scissors stapler eraser drive car truck road basketball skateboard statue box square circle tree grass flower plant rose ]
500.times do
password = adjectives[rand(adjectives.size)] + nouns[rand(nouns.size)] + rand(10).to_s
puts password + "\t" + Digest::SHA512.hexdigest(password + "thisGETSridOFrainbowTABLES")
end