Skip to content

Instantly share code, notes, and snippets.

View homecoder's full-sized avatar

Michael Ruggiero homecoder

  • Toronto, Canada
View GitHub Profile
@homecoder
homecoder / _tabview.py
Last active January 4, 2020 07:16
Pythonista TabView (Clone of iOS Tabbed Application)
# -*- coding: utf-8 -*-
"""
TabView - Clone of iOS Tabbed Application Bar
Copyright 2018 Michael Ruggiero
Released under MIT License - https://opensource.org/licenses/MIT
IMPORTANT: This was thrown together in tidbits of spare time while on my phone. It could definitely use a recfactor,
and as such, you may see some things which may not make sense, and/or aren't the greatest idea.
@homecoder
homecoder / switch.py
Created February 23, 2018 05:30
Python 'switch' statement.
# -*- coding: utf-8 -*-
"""
Copyright 2018 Michael Ruggiero - This code is released under the MIT License.
Personal Request: If you find this useful, can you reach out to me on GitHub (create an issue, just email me michael AT ruggiero.co) I'd really love to see/hear how it was used.
Of course, it's MIT so you don't have to; just leave the copyright in-tact as per the license.
LICENSE:
Copyright 2018 Michael Ruggiero
@homecoder
homecoder / pipista.py
Created November 28, 2017 03:24 — forked from pudquick/pipista.py
pipista - pip module (for installing other modules) for Pythonista
import os, os.path, sys, urllib2, requests
class PyPiError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def _chunk_report(bytes_so_far, chunk_size, total_size):
if (total_size != None):
@homecoder
homecoder / named_tuple_no_defaults.py
Last active November 24, 2017 17:52
Named Tuple configurable defaults
# Based on code found @ https://stackoverflow.com/a/18348004/7513482
import collections
import sys
def namedtuple_with_defaults(typename, field_names, default_values=(), verbose=False, rename=False, module=None):
"""
Create a namedtuple object with customizable defaults.
Returns a new tuple subclass named typename