Skip to content

Instantly share code, notes, and snippets.

View jovialcore's full-sized avatar
👨‍🍳
cooking

Chidiebere Chukwudi jovialcore

👨‍🍳
cooking
View GitHub Profile
@wpscholar
wpscholar / .htaccess
Last active April 16, 2022 20:26
Redirect an old domain to a new domain with .htaccess
<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>
@ethanstenis
ethanstenis / Postman POST PUT Requests.txt
Last active July 6, 2024 21:17
How to make Postman work with POST/PUT requests in Laravel...
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({
@yugo412
yugo412 / LoginController.php
Last active January 28, 2024 15:52
Redirect to custom URL after logout on Laravel
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
class LoginController extends Controller
@luisciphere
luisciphere / Bootstrap Table CSS
Last active August 29, 2023 06:06
Bootstrap tables only css
.table {
width: 100%;
max-width: 100%;
margin-bottom: 1rem;
}
.table th,
.table td {
padding: 0.75rem;
vertical-align: top;
@connor11528
connor11528 / ScapeGreenhouse.php
Last active January 6, 2024 21:50
Artisan command to scrape jobs from Greenhouse.io
<?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

Cheat sheet: JavaScript Array methods

Deriving a new Array from an existing Array:

['■','●','▲'].slice(1, 3)           ['●','▲']
['■','●','■'].filter(x => x==='■')  ['■','■']
    ['▲','●'].map(x => x+x)         ['▲▲','●●']
    ['▲','●'].flatMap(x => [x,x])   ['▲','▲','●','●']
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active October 14, 2024 00:05
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

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.

@jovialcore
jovialcore / php_post_curl_wrapper_class.php
Last active April 13, 2023 09:47
A php curl wrapper class that lets you make a post curl operation in a more elegant style.
<?php
class culrpost
{
protected $url;
protected $curl;
public $result;