Skip to content

Instantly share code, notes, and snippets.

@mscalora
mscalora / form-names.js
Created July 3, 2014 00:46
Bookmarklet to view form info (names)
(function(){
if($('#form___names').length) {
$('form').css('outline','');
$('#form___names,.form___names').remove();
} else {
$('head,body').first().append('<style id="form___names">'+
":hover + div.form___names > div, div.form___names > div:hover { background: white; z-index:99999999; opacity: 1; } "+
"form:hover span.form___names { position:fixed; padding: 10px; background: white; top: 4px; left: 4px; font-size: 20px; z-index:99999999; padding: 6px; border: 3px solid gray; display: block; border-radius: 5px; } span.form___names { display:none; } "+
"div.form___names { display:inline-block;position:relative; } "+
"div.form___names div { white-space: nowrap; position:absolute; color:'+c+'; bottom:0; -webkit-transform: rotate(-12deg); -webkit-transform-origin: top left; z-index:99999998; padding: 1px 2px 2px; opacity: 0.5;} "+
@mscalora
mscalora / gist:1c4212b060670fa11411
Created July 11, 2014 16:51
Morse Code Perl Hash
my %morse_code = qw( A .- B -... C -.-. D -.. E . F ..-. G --. H ....
I .. J .--- K -.- L .-.. M -- N -. O --- P .--. Q --.- R .-. S ...
T - U ..- V ...- W .-- X -..- Y -.-- Z --.. 0 ----- 1 .----
2 ..--- 3 ...-- 4 ....- 5 ..... 6 -.... 7 --... 8 ---.. 9 ----. );
@mscalora
mscalora / gist:d7c09de6394a6ffe60cb
Created July 28, 2014 14:14
Token generator in python (1,0,o,O,i,I,l,L) eliminated, all 54 other alphanumerics used
#!/usr/bin/env python
import string
import random
tchars = "abcdefghjkmnpqrstuvwxyZABCDEFGHJKMNPQRSTUVWXYZ23456789"
def token(length):
return ''.join(random.choice(tchars) for _ in range(length))
@mscalora
mscalora / index.html
Created July 29, 2014 21:25
State/Territory/Protectorate/Province/Prefecture
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<title>Test</title>
<style>
.disabled {
opacity: 0.5;
}
</style>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Mount Olympus.kml</name>
<Style id="sn_ylw-pushpin">
<LineStyle>
<color>ff0000ff</color>
<width>3</width>
</LineStyle>
</Style>
@mscalora
mscalora / gist:d228a7e2e0b4b619bec6
Last active August 29, 2015 14:05
jQuery UI Busy Dialog
<!DOCTYPE html>
<html>
<head>
<title>Busy Dialog Test</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script>
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet" />
<style>
#test-main {
@mscalora
mscalora / gist:b35d7910b8e5f0a9593c
Created October 28, 2014 10:31
Chain calls to an asynchronous function using jQuery promises
<!doctype html>
<html>
<head>
<title>I Promise</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdn.rawgit.com/alexei/sprintf.js/master/src/sprintf.js"></script>
<style>
.rect {
height: 40px;
margin-bottom: 20px;
@mscalora
mscalora / gist:c9833db193d47d546195
Created October 31, 2014 13:27
Create a link to download the inner HTML of the body without script or noscript elements
$('<a download="body-html.html">Download Body HTML</a>').attr('href','data:text/html,'+encodeURIComponent($('body').clone().find('script, noscript').remove().end().html())).prependTo('body')
#!/usr/bin/env bash
if [ "$1" == "" ] ; then
__keyword="python"
else
__keyword="$1"
fi
(
while :; do
#! /usr/bin/env bash
until ping -c 1 10.10.10.200 ; do echo "Waiting 1 min" ; sleep 60 ; done
# MacOS play sounds:
for f in /System/Library/Sounds/*.aiff ; do echo $f ; afplay $f ; done