$ sudo xcodebuild -license
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ curl -s "https://get.sdkman.io" | bash
"""http://peter-hoffmann.com/2010/extrinsic-visitor-pattern-python-inheritance.html""" | |
class Node(object): | |
pass | |
class A(Node): | |
pass | |
class B(Node): | |
pass |
tap "homebrew/bundle" | |
tap "homebrew/cask" | |
tap "homebrew/core" | |
tap "thoughtbot/formulae" | |
brew "carthage" | |
brew "ffmpeg" | |
brew "gist" | |
brew "mas" | |
brew "pidcat" |
# -*- coding:utf-8 -*- | |
import json | |
import sqlite3 | |
JSON_FILE = "some.json" | |
DB_FILE = "some.db" | |
traffic = json.load(open(JSON_FILE)) | |
conn = sqlite3.connect(DB_FILE) |
# -*- coding: utf-8 -*- | |
""" | |
A class which defines a composit object which can store | |
hierarchical dictionaries with names. | |
This class is same as a hierarchical dictionary, but it | |
provides method to add/accesss/modify children by name, | |
like a Composit. |
import android.util.Log; | |
import java.util.HashMap; | |
import java.util.Map; | |
import rx.Observable; | |
import rx.Observable.OnSubscribe; | |
import rx.Subscriber; | |
import rx.functions.Action1; |
# http://stackoverflow.com/questions/963965/how-is-this-strategy-pattern | |
# -written-in-python-the-sample-in-wikipedia | |
""" | |
In most of other languages Strategy pattern is implemented via creating some | |
base strategy interface/abstract class and subclassing it with a number of | |
concrete strategies (as we can see at | |
http://en.wikipedia.org/wiki/Strategy_pattern), however Python supports | |
higher-order functions and allows us to have only one class and inject | |
functions into it's instances, as shown in this example. | |
""" |
# -*- coding:utf-8 -*- | |
""" | |
@author: Diogenes Augusto Fernandes Herminio <diofeher@gmail.com> | |
https://gist.github.com/420905#file_builder_python.py | |
""" | |
class Director(object): | |
def __init__(self): | |
self.buider = None |
"""http://ginstrom.com/scribbles/2007/10/08/design-patterns-python-style/ | |
An example of the Template pattern in Python""" | |
ingredients = "spam eggs apple" | |
line = '-' * 10 | |
# Skeletons | |
def iter_elements(getter, action): | |
"""Template skeletons that iterates items""" |
case class MyClass(number: Int, multiplier: Multiplier) { | |
def calc: Int = { | |
number * multiplier.number | |
} | |
} | |
case class Multiplier(number: Int) | |