Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Ruggiero homecoder

  • Toronto, Canada
View GitHub Profile
@homecoder
homecoder / _tabview.py
Last active Jan 4, 2020
Pythonista TabView (Clone of iOS Tabbed Application)
View _tabview.py
# -*- 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 Feb 23, 2018
Python 'switch' statement.
View switch.py
# -*- 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 Nov 28, 2017 — forked from pudquick/pipista.py
pipista - pip module (for installing other modules) for Pythonista
View pipista.py
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 Nov 24, 2017
Named Tuple configurable defaults
View named_tuple_no_defaults.py
# 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