Skip to content

Instantly share code, notes, and snippets.

View ryanscherler's full-sized avatar

Ryan Scherler ryanscherler

View GitHub Profile
@felixdorner
felixdorner / package.json
Last active December 25, 2022 15:00
Example workflow: NPM scripts to process PostCSS while watching files, starting a server and syncing with the browser.
{
"name": "Example",
"version": "0.0.1",
"description": "Example workflow",
"author": "You <[email protected]>",
"license": "MIT",
"postcss": {
"plugins": {
"postcss-easy-import": {},
"postcss-preset-env": {
@poul-kg
poul-kg / valet.conf
Last active July 2, 2025 19:35
CORS Rules for Laravel Valet Nginx
# To enable CORS you should add lines with CORS rules below to your valet.conf file
# Find the file /usr/local/etc/nginx/valet/valet.conf - this is Valet conf for Nginx
# of try to execute `locate valet.conf` and find the `valet.coinf` in `nginx` subdirectory
# after you edit your valet.conf do not forget to execute `valet restart`
server {
listen 80 default_server;
root /;
charset utf-8;
client_max_body_size 128M;
@mrneatly
mrneatly / Language.php
Last active August 31, 2018 01:49
A middleware for Slim 3 framework to enable locale in URL
<?php
namespace middleware\multilanguage;
class Language {
protected $language;
public function __construct($default) {
if (!is_string($default)) {
throw new \Exception('Not a string.');
@kellenmace
kellenmace / get-id-of-main-site-in-wordpress-multisite.php
Created May 26, 2017 18:59
Get the Blog ID of the Main Site in a WordPress Multisite Network
<?php
/*
* Get the Blog ID of the main site in a multisite network.
*
* @return int The blog_id of the main site.
*/
function km_get_main_site_blog_id() {
return get_network()->site_id;
}
@a-am
a-am / craft3_syntax_list.md
Last active January 23, 2018 01:32
Collection of syntax changes for CraftCMS 3

REQUEST

Craft::$app->getRequest()
Craft::$app->getRequest()->getAcceptsJson()
$this->asJson();

CURRENT USER

Craft::$app-&gt;getUser()-&gt;getIdentity()
@peterdemartini
peterdemartini / command.sh
Last active August 21, 2025 21:36
Exclude node_modules in timemachine
find `pwd` -type d -maxdepth 3 -name 'node_modules' | xargs -n 1 tmutil addexclusion
@nfourtythree
nfourtythree / Password Protect Serverpilot App.md
Last active February 6, 2025 21:58
Password Protect Serverpilot App

How to password protect your Serverpilot app

This is a quick (rough) guide on how to protect a Serverpilot pilot app with auth basic

1. SSH into your Serverpilot Server

2. Create a htpasswd file in your app

@marzepani
marzepani / .yarnclean
Last active December 14, 2016 20:28
Place this file in the project root, before you call `yarn clean` to save you from trouble. (Thx @zcei for pointing at this option 👍)
!browser-sync-ui/lib/plugins/history
!svgo/.svgo.yml
@LostKobrakai
LostKobrakai / ProcessWireValetDriver.php
Created October 15, 2016 10:25
ProcessWire Valet Driver
<?php
class ProcessWireValetDriver extends BasicValetDriver
{
private $possibleDirectories = [
'', // PW in root, do not remove except you're sure you never use it
'/dist',
'/public'
];
@alexsasharegan
alexsasharegan / .htaccess
Created September 7, 2016 00:36
Apache Config for React Router
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]