Author: Chris Lattner
import Foundation | |
/** | |
Creates an array of weak reference objects. | |
- Important: | |
Because this is an array of weak objects, the objects in the array can be removed at any time. | |
The collection itself will handle removing nil objects (garbage collection) via the private function cleanUpNilContainers() | |
*/ |
language: python | |
# ===== Linux ====== | |
os: linux | |
dist: xenial | |
python: | |
- 2.7 | |
- 3.6 | |
- 3.7 | |
- 3.8 | |
- 3.9 |
State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?
There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.
Here I present a composable pattern for pure state machiness with effects,
Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.
If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.
http://www.apple.com/osx/elcapitan-preview/
- split view - two apps side by side on full screen
// | |
// CollectionViewDataSource.swift | |
// Khan Academy | |
// | |
// Created by Andy Matuschak on 10/14/14. | |
// Copyright (c) 2014 Khan Academy. All rights reserved. | |
// | |
import UIKit |
// | |
// main.swift | |
// Routes | |
// | |
// Created by Chris Eidhof on 17/08/14. | |
// Copyright (c) 2014 Chris Eidhof. All rights reserved. | |
// | |
import Foundation |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
# Using this script downloads ALL the videos in NSScreencast. | |
# Use it wisely, it's extra load/bandwidth for the NSScreencast website. | |
# Usage: `EMAIL=your email PASSWORD=your password COUNT=how many videos should be downloaded? ruby download-nsscreencast.rb` | |
require "mechanize" | |
require "parallel" | |
mechanize = Mechanize.new | |
mechanize.post("https://www.nsscreencast.com/user_sessions", {"email" => ENV["EMAIL"], "password" => ENV["PASSWORD"]}) | |
mechanize.pluggable_parser.default = Mechanize::Download |
import java.util.Arrays; | |
/** | |
* class HuffmanTree | |
* @author M. Said Ozcan | |
*/ | |
public class HuffmanTree { | |
static int non_zero_element_count; |