Skip to content

Instantly share code, notes, and snippets.

@metaist
metaist / jquery.removeRegexClass.js
Last active August 29, 2015 14:07
jQuery.removeClass, but allow regular expressions.
(function (factory) {
'use strict';
if ('function' === typeof define && define.amd) {
define(['jquery'], factory); // register anonymous AMD module
} else { factory(jQuery); } // browser globals
}(function (jQuery) {
'use strict';
var
$ = jQuery,
orig = $.fn.removeClass,
@metaist
metaist / falling-square.html
Last active August 29, 2015 14:11
Canvas Demos
<!DOCTYPE html>
<html>
<head>
<style>
html, body { margin: 0; }
canvas {
position: absolute;
height: 100%;
width: 100%;
margin: 0;
@metaist
metaist / echo.php
Created June 11, 2015 18:18
Better TwiML Echo
<?php
header('Content-Type: text/xml');
$result = $_GET['Twiml'];
foreach($_REQUEST as $k => $v) {
if ($k === 'Twiml') { continue; } // avoid infinite loop
$result = str_replace('${' . $k . '}', $v, $result);
}//end for: replaced all the tokens
echo $result;
@metaist
metaist / .bashrc
Last active September 2, 2015 18:50
Better virtualenv activate.
# Show virtual environment (if any) and git branch (if any; requires .git-prompt.sh).
source ~/.git-prompt.sh
__blank="\[\e]0;\w\a\]\n" # white
__virtualenv=`basename "$VIRTUAL_ENV"`
__userhost="\[\e[32m\]\u@\h" # green
__pwd="\[\e[33m\]\w" # yellow
__cursor="\[\e[0m\]\n\$ " # white
export PS1="${__blank}${__virtualenv:+$__virtualenv }${__userhost} ${__pwd}\$(__git_ps1)${__cursor}"

<text> look too bold?

text { 
  stroke: none;
  fill: #000;

}

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>todo</string>
</array>
<key>name</key>
<string>TODO</string>
@metaist
metaist / namespace.py
Created April 14, 2016 02:27
Manage flexible dicts in python.
#!/usr/bin/env python
# coding: utf-8
'''Manage namespaces.'''
# Native
import collections
# <dict> shorthand
_del = dict.__delitem__
@metaist
metaist / video-speed.html
Last active February 13, 2017 19:36
HTML5 Video Speed Bookmarklet
javascript:(function(){ window.rate = prompt('Enter playback rate.', window.rate||1) || window.rate || 1; Array.from(document.getElementsByTagName('video')).forEach(function(d) {d.playbackRate = window.rate})})();
@metaist
metaist / amazon-wishlist.js
Created July 31, 2017 03:26
Extract title, author, price, and audible information from your Amazon Wishlist.
var results = [];
var urls = [];
if (typeof jQuery=='undefined') {
script = document.createElement( 'script' );
script.src = 'https://code.jquery.com/jquery-3.2.1.min.js';
script.onload=getTitles;
document.body.appendChild(script);
} else {
getTitles();
@metaist
metaist / index.html
Created March 22, 2018 17:17
Banana or Not?
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
</head>
<body>
<nav>
<div class="nav-wrapper">
<a href="#" class="brand-logo">Banapple</a>