Adapted from Mark Shead's blog.
-
Login to remote host with SSH:
local $ ssh remote`
Adapted from Mark Shead's blog.
Login to remote host with SSH:
local $ ssh remote`
#!/usr/bin/env xcrun swift | |
import Dispatch | |
let appQueue = dispatch_queue_create("org.tkareine.NodeLike.appQueue", DISPATCH_QUEUE_SERIAL) | |
let appGroup = dispatch_group_create() | |
func delay(delayInMS: Int, block: () -> Void) { | |
let delayInNS = Int64(delayInMS) * Int64(NSEC_PER_MSEC) | |
let scheduleAt = dispatch_time(DISPATCH_TIME_NOW, delayInNS) |
# coding: utf-8 | |
module PFork | |
extend self | |
# Call function +fun+ in a child process, giving access to the child process | |
# id and capturing STDIN, STDOUT, and STDERR of the function call. | |
# | |
# Adapted from stdlib's Open3::popen3 and | |
# {Open4::popen4}[https://github.com/ahoward/open4] by Ara T. Howard, but |
package org.tkareine.validation_example; | |
import java.sql.SQLException; | |
import java.time.LocalDate; | |
import java.util.LinkedHashMap; | |
import java.util.Map; | |
import java.util.Optional; | |
/** | |
* Design considerations: |
#!/usr/bin/env ruby | |
# coding: utf-8 | |
require 'thread' | |
class CountDownLatch | |
attr_reader :count | |
def initialize(to) | |
@count = to.to_i |
require 'benchmark' | |
def with_greet(name) | |
yield "hi, #{name}" | |
end | |
def with_greet_jack | |
with_greet("jack") { |greet| yield greet } | |
end |
$ ruby test_pty.rb ./ex19 | |
[child] You enter the The great hall. | |
[child] | |
[child] > | |
--(interaction)-- | |
[child] You can go: | |
[child] NORTH | |
[child] | |
[child] > | |
--(interaction)-- |
Q = require 'q' | |
value = if this.require 'aa' else 'bb' # missing `then` in `if` expr; should be compile error | |
incorrectChain = Q.nfcall(fun).then( | |
(result) -> console.log 'Result', result | |
, (error) -> console.error 'Error', error # a small indentation error | |
) | |
fun = (callback) -> callback(new Error('intentional error')) |
value = if this.require 'aa' else 'bb' # missing `then` in `if` expr |
var subj0 = new Rx.Subject() | |
var obs0 = subj0.doAction(function(e) { console.log("obs0 doAction", e) }) | |
var subs0_1 = obs0.subscribe(function(e) { console.log("subs0_1", e) }) | |
subj0.onNext('a') | |
//> obs0 doAction a | |
//> subs0_1 a | |
var subs0_2 = obs0.subscribe(function(e) { console.log("subs0_2", e) }) | |
subj0.onNext('b') |