Skip to content

Instantly share code, notes, and snippets.

@sh78
sh78 / censor.py
Created October 30, 2015 23:46
My submission for the Built-In Python Functions assignment in Udacity's Programming Foundations With Python course.
import string
import sys
import re
# define method that can censor a string
def censor(the_input, blacklist, replacements):
# create a receptacle for the censored output
censored = []
# split input into words, using the regex split method to preverve formatting
words = re.split(r'(\s+)', the_input)
<audio controls autoplay muted volume="0.5">
<source src="audio_file.ogg" type="audio/ogg">
<source src="audio_file.mp3" type="audio/mpeg">
</audio>
<video controls preload="metadata" autoplay loop muted poster="poster_image.png">
<source src="video_file.mp4" type="video/mp4">
<source src="video_file.ogg" type="video/ogg">
<!--
Accessibility: Include valid WEBVTT caption file(s)
https://developer.mozilla.org/en-US/Apps/Build/Audio_and_video_delivery/Adding_captions_and_subtitles_to_HTML5_video
https://quuz.org/webvtt/
-->
<track label="English" kind="subtitles" srclang="en" src="subtitles-en.vtt" default>
<track label="Director's Commentary In German" kind="captions" srclang="de" src="commentary-de.vtt">
/* use a CSS selector to change the value of multiple text inputs on a page with the browser console */
// Enter a css selector to operate on
var theSelectorIsHere = 'TYPE_HERE';
// Enter desired value
var whatItShouldBe = 'TYPE_HERE';
// Don't worry about this part, paste in the the browser console
var whereItShouldBe = document.querySelectorAll(theSelectorIsHere);
<!-- SVG spritemap definition & usage example -->
<!--
Define Some SVGs
External .svg file recommended, or inline below opening <body>
-->
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="icon1" viewBox="0 0 161.4 188.9">
<title>For Screenreaders</title>
<table>
<thead>
<tr>
<th scope="col">DATA1</th>
<th scope="col">DATA2</th>
<th scope="col">DATA3</th>
</tr>
</thead>
<tfoot>
<tr>
function myfunc --description "Basic Function. Args Are Built In"
echo $argv
echo $argv[1] $argv[2] # no zero indices in the ocean...
end
# └> myfunc one two three
# one two three
# one two two
function myfunc --description "Basic Function With Variables"
# credit to http://www.artificialworlds.net/blog/2012/10/17/bash-associative-array-examples/
# Basics
declare -A MYMAP # Create an associative array
MYMAP[foo]=bar # Put a value into an associative array
echo ${MYMAP[foo]} # Get a value out of an associative array
# => bar
echo MYMAP[foo] # WRONG
# => MYMAP[foo]
^[^THIS|THAT].*
^(.*)(\r?\n\1)+$