Linear interpolation. Given a start, an end, and a fraction t ∈ [0,1], lerp returns a value in between:
lerp(a, b, t) = a + (b - a) * t
t = 0➜ startt = 1➜ end
| import androidx.compose.ui.tooling.preview.PreviewParameterProvider | |
| import kotlin.reflect.KClass | |
| /** | |
| * Creates a [PreviewParameterProvider] based on the classes of two existing providers. | |
| * | |
| * You can create your own easily with Kotlin delegation: | |
| * ``` | |
| * class ExampleProvider : PreviewParameterProvider<Pair<Type1, Type2>> | |
| * by compositeProvider(Type1ParameterProvider::class, Type2ParameterProvider::class) |
| // NOTE: This code uses Compose 1.0.0-beta09 | |
| import androidx.compose.foundation.Canvas | |
| import androidx.compose.foundation.layout.BoxWithConstraints | |
| import androidx.compose.foundation.layout.padding | |
| import androidx.compose.foundation.layout.size | |
| import androidx.compose.material.MaterialTheme | |
| import androidx.compose.material.Text | |
| import androidx.compose.runtime.Composable | |
| import androidx.compose.runtime.getValue |
| /** | |
| * Returns a [State] holding a local animation time in milliseconds. | |
| * The value always starts at `0L` and stops updating when | |
| * the call leaves the composition. | |
| */ | |
| @Composable | |
| fun animationTimeMillis(): State<Long> { | |
| val millisState = state { 0L } | |
| val lifecycleOwner = LifecycleOwnerAmbient.current | |
| launchInComposition { |
| # example color list: | |
| c = """#e41a1c | |
| #377eb8 | |
| #4daf4a | |
| #984ea3 | |
| #ff7f00 | |
| #ffff33 | |
| #a65628 | |
| #f781bf | |
| #999999""" |
| import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse } from '@angular/common/http'; | |
| import { Observable } from 'rxjs/Observable'; | |
| import { map } from 'rxjs/operators'; | |
| import * as CryptoJS from 'crypto-js'; | |
| export class RequestInterceptor implements HttpInterceptor { | |
| intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
| // Encrypt the body. | |
| const updatedReq = req.clone({ |
Charles supports a few command line options out of the box, documented here.
Unfortunately they seem to operate only as parameters for new Charles sessions, so you won't be able to run commands on a running instance of Charles.
Start a specific Charles session
A Charles session contains all of your recorded information. It is represented by the Session window; by default a new session is automatically created when you start Charles.
Sessions can be saved from File → Save Session (⌘+S).
Once saved, if you want you can start Charles from the saved session by running:
| # See list of docker virtual machines on the local box | |
| $ docker-machine ls | |
| NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS | |
| default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1 | |
| # Note the host URL 192.168.99.100 - it will be used later! | |
| # Build an image from current folder under given image name | |
| $ docker build -t gleb/demo-app . |
| const fs = require('fs'); | |
| const yargs = require('yargs'); | |
| const { Argv } = yargs; | |
| const { promisify } = require('util'); | |
| const { resolve } = require('path'); | |
| const exists = promisify(fs.exists); | |
| const readFile = promisify(fs.readFile); | |
| const writeFile = promisify(fs.writeFile); |