Skip to content

Instantly share code, notes, and snippets.

@gilbitron
gilbitron / CaddyController.php
Created June 16, 2021 10:55
Enabling HTTPS (SSL) for Laravel Sail using Caddy
<?php
# app/Http/Controllers/CaddyController.php
namespace App\Http\Controllers;
use App\Store;
use Illuminate\Http\Request;
class CaddyController extends Controller
{
@humantorch
humantorch / http_accept_language.php
Last active February 26, 2021 21:37
Compare supported languages with HTTP_ACCEPT_LANGUAGE in a users' browser.
<?php
// Languages we support
$available_languages = array("zh-cn", "ca", "es", "fr", "af","nl", "sp", "en");
$default_language = "en"; // a default language to fall back to in case there's no match
function prefered_language($available_languages, $http_accept_language) {
global $default_language;
$available_languages = array_flip($available_languages);

Things that programmers don't know but should

(A book that I might eventually write!)

Gary Bernhardt

I imagine each of these chapters being about 2,000 words, making the whole book about the size of a small novel. For comparison, articles in large papers like the New York Times average about 1,200 words. Each topic gets whatever level of detail I can fit into that space. For simple topics, that's a lot of space: I can probably walk through a very basic, but working, implementation of the IP protocol.

@Azeirah
Azeirah / Default (Linux).sublime-keymap
Last active December 17, 2017 18:50
The settings for my sublime text set-up
[
// Use paste and indent as default paste mechanism,
// this conserves your indentation and it's overall better.
// original paste is now ctrl+shift+v
{
"keys": ["ctrl+v"],
"command": "paste_and_indent"
}, {
"keys": ["ctrl+shift+v"],
"command": "paste"