Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-goption.
| {-# LANGUAGE TemplateHaskell #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE DeriveFunctor #-} | |
| import Control.Lens | |
| import Prelude hiding (readFile, writeFile, print) | |
| import qualified Prelude as Prelude(readFile, writeFile, print) |
| sudo su | |
| apt-get install -y autoconf automake libtool nasm make pkg-config | |
| cd /tmp | |
| wget https://github.com/mozilla/mozjpeg/releases/download/v3.1/mozjpeg-3.1-release-source.tar.gz | |
| tar -xvf mozjpeg-3.1-release-source.tar.gz | |
| cd mozjpeg | |
| autoreconf -fiv | |
| mkdir build && cd build | |
| sh ../configure | |
| make install |
Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-goption.
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.
| 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} |
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.
A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
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| 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(); |