- Michele Titolo @micheletitolo
- Who's built, designed, and spec'd a lot of APIs
- Talk will focus on web APIs, but applies to many programmatic APIs, too
- good: it exists (and bonus points if it's interactive: I/O Docs is one nice example)
#!/usr/bin/env bash | |
# If your OS X WiFi connection stops working, but can be fixed by | |
# toggling WiFi off and then on, this script can help prevent mouse arm. | |
# Pings Apple's server repeatedly, toggling WiFi off/on when a connection times out. | |
while true ; do | |
curl --head --silent --connect-timeout 10 http://www.apple.com/my-wifi-keeps-dropping-out > /dev/null | |
if [ $? -ne 0 ] ; then | |
networksetup -setairportpower en1 off | |
networksetup -setairportpower en1 on |
A running example of the code from:
This gist creates a working example from blog post, and a alternate example using simple worker pool.
TLDR: if you want simple and controlled concurrency use a worker pool.
When Swift was first announced, I was gratified to see that one of the (few) philosophies that it shared with Objective-C was that exceptions should not be used for control flow, only for highlighting fatal programming errors at development time.
So it came as a surprise to me when Swift 2 brought (What appeared to be) traditional exception handling to the language.
Similarly surprised were the functional Swift programmers, who had put their faith in the Haskell-style approach to error handling, where every function returns an enum (or monad, if you like) containing either a valid result or an error. This seemed like a natural fit for Swift, so why did Apple instead opt for a solution originally designed for clumsy imperative languages?
I'm going to cover three things in this post:
// meet Stringy - a simple string type with a fluent interface | |
struct Stringy { | |
let content: String | |
init(_ content: String) { | |
self.content = content | |
} | |
func append(appendage: Stringy) -> Stringy { |
/* | |
This script is meant to be used with a Google Sheets spreadsheet. When you edit a cell containing a | |
valid CSS hexadecimal color code (like #000 or #000000), the background color will change to that | |
color and the font color will be changed to the inverse color for readability. | |
To use this script in a Google Sheets spreadsheet: | |
1. go to Tools » Script Editor; | |
2. replace everyting in the text editor with this code; | |
3. click File » Save; |
... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
package main | |
import ( | |
"log" | |
"os" | |
"github.com/samalba/dockerclient" | |
) | |
func main() { |