Skip to content

Instantly share code, notes, and snippets.

View ticky's full-sized avatar
💽

Jessica Stokes ticky

💽
View GitHub Profile
"use strict";
/* Create a Constructor with an arbitrary name *
* This allows the resultant object to be of a *
* named "type", allowing inspection of types *
* without adding keys to the object itself */
function constructorNamed(name) {
return (new Function(["return function ", name, "() {return this;}"].join('')))();
}
#!/usr/bin/env python
# Trying to achieve a command line option list like this
# argparsetest.py [--url <url> [[--string <string>] [--string-two <string>] | --boolean [--number <number>]]]
# This crashes if you pass it --help. Why?
from argparse import ArgumentParser
parser = ArgumentParser('demonstration of argparse issue')
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@ticky
ticky / dabblet.css
Created June 19, 2013 05:29
Status Icons
/**
* Status Icons
*/
div {
font-size: 15px;
}
circle.active {
fill: rgba(124,198,0,0.7);
}
circle.inactive {
@ticky
ticky / dabblet.css
Created May 18, 2013 11:09
Windows 98
/**
* Windows 98
*/
body {
-webkit-font-smoothing: none;
font-family: "MS Sans Serif", "Microsoft Sans Serif";
margin: 0;
padding: 0;
background-color: #008080;
@ticky
ticky / feedbin-instapaper-text.js
Created April 30, 2013 03:12
Use this as a "share" URL in Feedbin and it'll inject an iframe with Instapaper's formatted version of the page inline.
javascript:(function(url) {feedbin_instaframe=document.createElement('iframe');feedbin_instaframe.src="http://www.instapaper.com/text?u="+url;feedbin_instaframe.style.width="100%";feedbin_instaframe.style.height="100%";feedbin_instaframe.style.border="1px solid #cacaca";feedbin_content_object=document.querySelector("div[data-behavior='entry_content_wrap']");feedbin_content_object.parentNode.appendChild(feedbin_instaframe);feedbin_content_object.style.display="none";}("${url}"));
@ticky
ticky / show-ids.css
Created April 12, 2013 07:58
User CSS to display element IDs where applicable. (Running this in your regular browsing will _break everything_, so don't!)
*[id]:before {
box-sizing: border-box;
content: "#"attr(id);
display: inline-block;
background-image: -webkit-gradient( radial, 50% 100%, 0, 50% 100%, 100, from(rgba(89, 208, 244, 1)), to(rgba(89, 208, 244, 0))), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#4FBBF7), to(#3FAEEB));
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 9px;
font-weight:lighter;
text-align:center;
line-height: 12px;
@ticky
ticky / jquery-latests.md
Last active October 13, 2015 06:08
jQuery Latests

jQuery Latests

The latest maintenance releases of each minor version of jQuery as of the update time.

Current

2.0 (No IE<9 Support)

2.0.3 Minified Release Notes

1.10

@ticky
ticky / isComplete.py
Last active October 12, 2015 20:47
Detect if a set of numbers is complete and consecutive
#!/bin/env python
# coding: utf-8
items = [
[1, 2, 3, 5, 6, 7, 7, 8, 9, 10,11,12], # false
[2, 3, 4, 5, 6, 7, 8, 9, 10,11,12], # false
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], # true
[1, 2, 2, 4, 5, 6, 7] , # false
[1, 2, 3, 4, 5, 7] , # false
[3, 5, 1, 2, 4] # true
@ticky
ticky / browser-regex.md
Last active October 19, 2023 23:13
Browser and Version regex

Browser and Version Regular Expression 2.0

(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d\.apre]+)

This regular expression is capable of retrieving the browser and version for the following browsers;

  • Internet Explorer
  • Firefox (INCLUDING alpha and "pre" versions)
  • Other browsers reporting a "Gecko" version in their user agent
  • Chrome
  • Safari
  • Other browsers reporting an "AppleWebKit" version in their user agent