Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CreatCodeBuild
CreatCodeBuild / GO: An OO Core with Functional Abilities.md
Last active April 17, 2018 03:53
GO: An OO Core with Functional Abilities.md

Why does OO weaken encapsulation?

class Something:
    def __init__(x, y, z):
        self.x = x
        self.y = y
        self.z = z
        
    def some_method():
 pass
@CreatCodeBuild
CreatCodeBuild / di.py
Created February 20, 2019 01:37
Dependency Injection: A Python Flask Example
from flask import Flask
class DAO:
def __init__(self):
self.data = []
def App(dao):
app = Flask("example")
@CreatCodeBuild
CreatCodeBuild / csp.js
Created May 5, 2019 22:48
Why "Generator is already running"? I need help!
const EventEmitter = require('events');
class MyEmitter extends EventEmitter { }
let e = new MyEmitter()
const DriveMainLoop = Symbol("DriveMainLoop");
// eventBus must be the kernel/task this sleeper belongs to
function Sleeper(eventBus, doneToken) {
return {