Here are several different ways to test a TCP port without telnet.
BASH (man page)
$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C
$ cat < /dev/tcp/127.0.0.1/23
# Changed to use content-type flag instead of header: -H 'Content-Type: application/json' | |
siege -c50 -t60S --content-type "application/json" 'http://domain.com/path/to/json.php POST {"ids": ["1","2","3"]}' |
Here are several different ways to test a TCP port without telnet.
$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C
$ cat < /dev/tcp/127.0.0.1/23
ZigZag-Encoding | |
--------------- | |
Maps negative values to positive values while going back and | |
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...) | |
(i >> bitlength-1) ^ (i << 1) | |
with "i" being the number to be encoded, "^" being | |
XOR-operation and ">>" would be arithemtic shifting-operation |
let timeout = 1000; | |
/** | |
* Create a custom observable that creates a XHR request and returns complete when the promise is fulfilled | |
*/ | |
let observable = Rx.Observable.create((o) => { | |
dataService.fetch('test.json') | |
.then((data) => { | |
o.onNext(data); | |
o.onCompleted(); |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.
A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
This is my attempt to give Scala newcomers a quick-and-easy rundown to the prerequisite steps they need to a) try Scala, and b) get a standard project up and running on their machine. I'm not going to talk about the language at all; there are plenty of better resources a google search away. This is just focused on the prerequisite tooling and machine setup. I will not be assuming you have any background in JVM languages. So if you're coming from Python, Ruby, JavaScript, Haskell, or anywhere… I hope to present the information you need without assuming anything.
Disclaimer It has been over a decade since I was new to Scala, and when I was new to Scala, I was coming from a Java and Ruby background. This has probably caused me to unknowingly make some assumptions. Please feel free to call me out in comments/tweets!
One assumption I'm knowingly making is that you're on a Unix-like platform. Sorry, Windows users.
defmodule ZipList do | |
defstruct previous: [], current: nil, remaining: [] | |
def from_list(list, index \\ 0) | |
def from_list([], _), do: {:error, :empty_list} | |
def from_list(list, index) when length(list) < index, do: {:error, :index_out_of_bounds} | |
def from_list(list, index) when is_list(list) do | |
previous = list |> Enum.take(index) |> Enum.reverse | |
[current | remaining] = Enum.drop list, index | |
ziplist = %__MODULE__{previous: previous, current: current, remaining: remaining} |
The LambdaConf Ladder of Functional Programming (LOFP) is a standardized progression of different concepts and skills that developers must master on their journey to becoming expert-level functional programmers. LOFP can be used to rank workshops, talks, presentations, books, and courseware, so that aspiring functional programmers have a better understanding of what material is appropriate for them given their current experience.