Adapted from Mark Shead's blog.
-
Login to remote host with SSH:
local $ ssh remote`
| value = if this.require 'aa' else 'bb' # missing `then` in `if` expr |
| 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')) |
| $ ruby test_pty.rb ./ex19 | |
| [child] You enter the The great hall. | |
| [child] | |
| [child] > | |
| --(interaction)-- | |
| [child] You can go: | |
| [child] NORTH | |
| [child] | |
| [child] > | |
| --(interaction)-- |
| require 'benchmark' | |
| def with_greet(name) | |
| yield "hi, #{name}" | |
| end | |
| def with_greet_jack | |
| with_greet("jack") { |greet| yield greet } | |
| end |
| #!/usr/bin/env ruby | |
| # A toy program demonstrating consuming REST API and quering and | |
| # inserting documents to MongoDB database with Ruby and its standard | |
| # library without extra dependencies. | |
| # | |
| # Usage: | |
| # | |
| # $ mongod # leave it running | |
| # |
| #!/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) |
| (defun tkareine/active-region-or-line () | |
| (if mark-active (list (region-beginning) (region-end)) | |
| (list (line-beginning-position) | |
| (line-beginning-position 2)))) | |
| (defun tkareine/comment-or-uncomment-region-or-line () | |
| (interactive) | |
| (let ((region (tkareine/active-region-or-line))) | |
| (when region | |
| (let ((rbegin (car region)) |
| package org.tkareine.demo.service.csv.parser; | |
| import com.google.inject.Inject; | |
| import org.tkareine.demo.model.Address; | |
| import org.tkareine.demo.model.Office; | |
| import org.tkareine.demo.service.OfficeService; | |
| import org.tkareine.demo.support.GuiceJUnit4ClassRunner; | |
| import org.tkareine.demo.support.di.StubExternalServicesMongoModule; | |
| import org.junit.Before; | |
| import org.junit.Test; |
Adapted from Mark Shead's blog.
Login to remote host with SSH:
local $ ssh remote`| 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: |