TL;DR
Install Postgres 9.6, and then:
sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main| // This can be imported via ./bin/gremlin.sh -i describe.groovy | |
| // A variable 'graph' must be defined with a JanusGraph graph | |
| // Run it as a plugin command ':schema' | |
| // :schema describe | |
| // | |
| import org.janusgraph.graphdb.database.management.MgmtLogType | |
| import org.codehaus.groovy.tools.shell.Groovysh | |
| import org.codehaus.groovy.tools.shell.CommandSupport |
| import Foundation | |
| final class ConcealingTitleView: UIView { | |
| private let label = UILabel() | |
| private var contentOffset: CGFloat = 0 { | |
| didSet { | |
| label.frame.origin.y = titleVerticalPositionAdjusted(by: contentOffset) | |
| } | |
| } | |
| var text: String = "" { |
| import Foundation | |
| func disable_gdb() { | |
| let PT_DENY_ATTACH: CInt = 31 | |
| let handle = dlopen("/usr/lib/libc.dylib", RTLD_NOW) | |
| let sym = dlsym(handle, "ptrace") | |
| typealias PtraceAlias = @convention(c) (CInt, pid_t, CInt, CInt) -> CInt | |
| let ptrace = unsafeBitCast(sym, to: PtraceAlias.self) | |
| _ = ptrace(PT_DENY_ATTACH, 0, 0, 0) | |
| dlclose(handle) |
TL;DR
Install Postgres 9.6, and then:
sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main| // | |
| // SimpleMediaSaver.swift | |
| // | |
| // Created by Dennis Lysenko on 27-09-16. | |
| // Copyright © 2016 Dennis Lysenko. All rights reserved. | |
| // https://gist.github.com/dennislysenko/5388cacb83b754e8983e99bff7fef2d2 | |
| // | |
| // This gist is licensed under the terms of the MIT license. | |
| // |
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,
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| ) | |
| type Aaa struct { | |
| a string | |
| } |
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "net/http" | |
| ) | |
| func main() { | |
| // We need to cast handleRoot to a http.HandlerFunc since wrapHandlerWithLogging |
| The MIT License (MIT) | |
| Copyright (c) 2016 Zev Eisenberg | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of | |
| this software and associated documentation files (the "Software"), to deal in | |
| the Software without restriction, including without limitation the rights to | |
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
| the Software, and to permit persons to whom the Software is furnished to do so, | |
| subject to the following conditions: |