Option<T> |
non-Option (T | undefined ) |
|
---|---|---|
accessing property | userOption.map(user => user.age) |
userNullish?.age |
calling a method | userOption.map(user => user.fn()) |
userNullish?.fn() |
providing fallback | ageOption.getOrElse(0) |
ageNullish ?? 0 |
filter | ageOption.filter(checkIsOddNumber) |
`ageNull |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# ilia/php_excel extension example install script for PHP7+ | |
# | |
# usage: | |
# > sudo ./install_phpexcel_php7.sh | |
# > (optionally) sudo service php7.1-fpm restart) | |
# | |
# requirements: | |
# - Ubuntu 64bits (trusty/xenial) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback, useLayoutEffect, DependencyList } from 'react' | |
/** | |
* This version bounces each version of the callback. This ensures that the callback | |
* will be called with each state of the application. That's why `deps` is a required argument. | |
* | |
* Previous version used `useRef` for `timeoutId` and didn't have `deps` argument. | |
* This resulted in missing calling the callback for the previous state and necessarily | |
* calling it for the new state. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Copyright © 2011 Erin Millard | |
*/ | |
/** | |
* Returns the number of available CPU cores | |
* | |
* Should work for Linux, Windows, Mac & BSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Form; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\Extension\Core\Type\PasswordType; | |
use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | |
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |
use Symfony\Component\Form\FormBuilderInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using: | |
// globby@11.0.4 | |
// chalk@4.1.2 | |
import globby from 'globby'; | |
import { dirname } from 'path'; | |
import { fileURLToPath } from 'url'; | |
import chalk from 'chalk'; | |
async function main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html><head><script src="app.js"></script></head><body></body></html> |
keyword: material ui, mui, typescript, intellisense, vscode
When using mui with typescript, there is performance issue with vscode intellisense, because of type checking.
I've read the comments and found a clue that some csstypes given by mui might be source of issue.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright (C) 2016 Donnie Ray Jones | |
Permission is hereby granted, free of charge, to any person obtaining a | |
copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: |
TOTALLY SUPER DUPER NOT MY WORK! Trying to illuminate how FizzyText (seen here, source here, isolated from dat.GUI dependency here) works. Original appears to have been written by George Michael Brower.
In the original, which I find brilliant:
- Solid black text is drawn onto an invisible canvas, from which it gets bitmap data
- The bitmap data is read like a collision detection array, where black means "you're on top of text" and white means "you're not"
- Particles of size r=0 are randomly spawned on a visible canvas
- The particles grow if they're on top of a (non-rendered) black pixel, and shrink till they disappear if not
- When they shrink to r=0, they respawn randomly somewhere
- The particles follow a Perlin noise flow field, a very sensible and fluid kind of random movement, in which nearby particles
OlderNewer