Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
/**********************************************/ | |
/* | |
/* IR_Black Skin by Ben Truyman - 2011 | |
/* | |
/* Based on Todd Werth's IR_Black: | |
/* http://blog.toddwerth.com/entries/2 | |
/* | |
/* Inspired by Darcy Clarke's blog post: | |
/* http://darcyclarke.me/design/skin-your-chrome-inspector/ | |
/* |
#!/usr/bin/env python | |
# This example demonstrates RSA public-key cryptography in an | |
# easy-to-follow manner. It works on integers alone, and uses much smaller numbers | |
# for the sake of clarity. | |
##################################################################### | |
# First we pick our primes. These will determine our keys. | |
##################################################################### |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
This article is now published on my website: Prefer Subshells for Context.
// ==UserScript== | |
// @name Referral: your mom | |
// @namespace yourmom | |
// @description This script changes every utm_source variable in links to 'Your mom'. | |
// @include * | |
// ==/UserScript== | |
var links = document.getElementsByTagName('a'); | |
for(var i=0; i<links.length; i++) { | |
links[i].href = links[i].href.replace(/([&|?])utm_source=(.*)([&|?|^])/,"$1utm_source=Your+mom$3"); |
<?php | |
function theme_form_alter(&$form, &$form_state, $form_id) { | |
if ($form_id == 'search_block_form') { | |
$form['search_block_form']['#title'] = t('Search'); // Change the text on the label element | |
$form['search_block_form']['#title_display'] = 'invisible'; // Toggle label visibilty | |
//$form['search_block_form']['#size'] = 40; // define size of the textfield | |
$form['search_block_form']['#default_value'] = t('Search'); // Set a default value for the textfield | |
//$form['actions']['submit']['#value'] = t('GO!'); // Change the text on the submit button | |
$form['actions']['submit'] = array('#type' => 'image_button', '#src' => base_path() . path_to_theme() . '/immagini/btnCerca.png'); |
var user = { | |
validateCredentials: function (username, password) { | |
return ( | |
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' } | |
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' } | |
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' } | |
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' } | |
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' } | |
: false | |
); |
// this is the background code... | |
// listen for our browerAction to be clicked | |
chrome.browserAction.onClicked.addListener(function (tab) { | |
// for the current tab, inject the "inject.js" file & execute it | |
chrome.tabs.executeScript(tab.ib, { | |
file: 'inject.js' | |
}); | |
}); |
#!/usr/bin/env python | |
import os | |
import sys | |
import socket | |
import struct | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
if len(sys.argv) > 1: |