Deriving a new Array from an existing Array:
['■','●','▲'].slice(1, 3) ⟼ ['●','▲']
['■','●','■'].filter(x => x==='■') ⟼ ['■','■']
['▲','●'].map(x => x+x) ⟼ ['▲▲','●●']
['▲','●'].flatMap(x => [x,x]) ⟼ ['▲','▲','●','●']
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR] | |
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$ | |
RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L] | |
</IfModule> |
To make Postman work with POST/PUT requests... | |
https://laravel.com/docs/5.2/routing#csrf-x-csrf-token | |
In addition to checking for the CSRF token as a POST parameter, the Laravel VerifyCsrfToken middleware will also check for the X-CSRF-TOKEN request header. | |
1. Store the token in a "meta" tag at the top of your root view file (layouts/app.blade.php)... | |
<meta name="csrf-token" content="{{ csrf_token() }}"> | |
** If using jQuery, you can now instruct it to include the token in all request headers. | |
$.ajaxSetup({ |
<?php | |
namespace App\Http\Controllers\Auth; | |
use App\Http\Controllers\Controller; | |
use Illuminate\Foundation\Auth\AuthenticatesUsers; | |
use Illuminate\Http\Request; | |
class LoginController extends Controller |
.table { | |
width: 100%; | |
max-width: 100%; | |
margin-bottom: 1rem; | |
} | |
.table th, | |
.table td { | |
padding: 0.75rem; | |
vertical-align: top; |
<?php | |
namespace App\Console\Commands; | |
use App\Company; | |
use App\JobListing; | |
use Illuminate\Console\Command; | |
use Goutte\Client; | |
class ScrapeGreenhouse extends Command |
<? | |
# MIT license, do whatever you want with it | |
# | |
# This is my invoice.php page which I use to make invoices that customers want, | |
# with their address on it and which are easily printable. I love Stripe but | |
# their invoices and receipts were too wild for my customers on Remote OK | |
# | |
require_once(__DIR__.'/../vendor/autoload.php'); |
brew tap homebrew/cask-fonts | |
brew install --cask font-cascadia-code | |
brew install --cask font-cascadia-code-pl | |
brew install --cask font-cascadia-mono | |
brew install --cask font-cascadia-mono-pl |
Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.
You use Next.js router like normally, but don't define getStaticProps
and such. Instead you do client-only fetching with swr
, react-query
, or similar methods.
You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)
Don't like Next? Here's how to do the same in Gatsby.
<?php | |
class culrpost | |
{ | |
protected $url; | |
protected $curl; | |
public $result; |