Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stefanocrosta
stefanocrosta / py_multiple_inheritance.py
Created November 28, 2016 14:48
full example of python multiple inheritance with MRO
# see http://stackoverflow.com/a/3277407/422670 and in particular comment by http://stackoverflow.com/users/81636/gatoatigrado
class First(object):
def __init__(self):
print "first prologue"
super(First, self).__init__()
print "first epilogue"
class Second(First):
def __init__(self):
@stefanocrosta
stefanocrosta / wrsynch.sh
Last active July 18, 2018 01:05
continuously rsync on file modification with fswatch (wrsync: watch & rsync) [or: an fswatch wrapper]
#!/bin/bash
# an rsync script that will synchronize files every time there's a modification
# in a WATCHed location, detected through fswatch
# https://github.com/emcrisostomo/fswatch
# (install fswatch through brew)
#
# this script could even be more general and allow executing anything,
# not just rsync; it's actually even overkill for the way it's used, since
# rsync is simple re-launched entirely and not just for the modified file!
@stefanocrosta
stefanocrosta / angularProviderExamples.js
Last active August 29, 2015 14:05
Angular Providers Examples
/**
* Equivalences between different AngularJS Provider constructs.
* Related documentation:
* - https://docs.angularjs.org/guide/providers
* and in particular checkout the summary: https://docs.angularjs.org/guide/providers#conclusion
*
* Related tutorials:
* AngularJS Patterns #27-#32
* - https://www.youtube.com/watch?v=Wrjjp_Up8K0
* - https://www.youtube.com/watch?v=8qOI5OUommo
@stefanocrosta
stefanocrosta / paginated_list_view.py
Created April 19, 2012 08:17
Django Paginated Class View
"""
Very simple PaginatedListView
"""
class PaginatedListView(ListView, FormView):
queryset = None
def get_context_data(self, **kwargs):
#logging.debug('ApplicationListView.get_context_data')
context = super(self.__class__, self).get_context_data(**kwargs)