I hereby claim:
- I am joergpatz on github.
- I am joergpatz (https://keybase.io/joergpatz) on keybase.
- I have a public key whose fingerprint is 05FE 7718 9BCC ED57 3D55 F740 32FC 2F86 6D54 97AE
To claim this, I am signing this object:
/** | |
* nextTick vs setImmediate, visual explanation | |
* | |
* https://stackoverflow.com/questions/17502948/nexttick-vs-setimmediate-visual-explanation | |
* https://nodejs.dev/learn/understanding-process-nexttick | |
*/ | |
// SETIMMEDIATE | |
setImmediate(function A() { |
const math = ([x, y], operation) => | |
operation(Number(x), Number(y)) | |
const plus = (x, y) => x + y | |
const minus = (x, y) => x - y | |
const times = (x, y) => x * y | |
const div = (x, y) => x / y | |
math`3 ${plus} 4` //7 | |
math`3 ${minus} 4` //-1 |
/** | |
* A pipe function takes an n sequence of operations | |
* in which each operation takes an argument process it and gives the processed output as an input for the next operation in the sequence. | |
* The result of a pipe function is a function that is a bundled up version of the sequence of operations. | |
* | |
* const pipe = (op1, op2, op3, ... , opN) => { | |
* return (arg) => opN(op3(op2(op1(arg)))); | |
* } | |
*/ | |
const bundle = (a, b) => arg => b(a(arg)); |
import { Directive, HostListener, ElementRef, Renderer } from '@angular/core'; | |
@Directive({ | |
selector: 'input' | |
}) | |
export class InputFocusForwarderDirective { | |
constructor(private elRef: ElementRef, private renderer: Renderer) { | |
} |
#!/bin/sh | |
set -e | |
cd ~/.nvm | |
git fetch --tags | |
TAG=$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo "Checking out tag $TAG..." | |
git checkout "$TAG" |
curl -u user:password -o "#1.jpg" https://example.org/\[1-10\].jpg |
- Right click on the object in console and click "Save as a global variable" | |
- the output will be something like "temp1" | |
- type in console copy(temp1) | |
- paste to your favorite text editor |
//because of security option: allow_url_fopen=0 | |
$uri = 'https://example.com/example.jpg'; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $uri); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$bin = curl_exec($ch); | |
$data = getimagesizefromstring($bin); |
I hereby claim:
To claim this, I am signing this object:
//fork a CLI script from a webserver PHP script using the popen() function | |
//This allows to nicely transfer parameters to the new script instance like this: | |
$bgproc = popen('php "/my/path/my-bckgrnd-proc.php"', 'w'); | |
if($bgproc===false){ | |
die('Could not open bgrnd process'); | |
}else{ | |
// send params through stdin pipe to bgrnd process: | |
$p1 = serialize($param1); | |
$p2 = serialize($param2); | |
$p3 = serialize($param3); |