Skip to content

Instantly share code, notes, and snippets.

@iforwms
iforwms / open-cors.conf
Created September 14, 2021 01:34
Open nginx CORS Config
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
@iforwms
iforwms / site.conf
Last active April 9, 2021 07:15
Allow slash arguements in Nginx
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
@iforwms
iforwms / moodle.sh
Last active February 18, 2021 02:25
Moodle Server config for Laravel Homestead
#!/usr/bin/env bash
declare -A params=$6 # Create an associative array
declare -A headers=${9} # Create an associative array
declare -A rewrites=${10} # Create an associative array
paramsTXT=""
if [ -n "$6" ]; then
for element in "${!params[@]}"
do
paramsTXT="${paramsTXT}
@iforwms
iforwms / creative-cloud-disable.md
Created January 4, 2021 01:12 — forked from andreibosco/creative-cloud-disable.md
disable creative cloud startup on mac
@iforwms
iforwms / calculate_reading_time.php
Created March 26, 2020 02:25 — forked from tomhazledine/calculate_reading_time.php
Calculate Reading Time (for WordPress content)
<?php
/**
* READING TIME
*
* Calculate an approximate reading-time for a post.
*
* @param string $content The content to be measured.
* @return integer Reading-time in seconds.
*/
function reading_time( $content ) {
@iforwms
iforwms / homestead-manual-install.md
Created March 20, 2020 05:54 — forked from idecardo/homestead-manual-install.md
Laravel Homestead Manual Installation

Getting Started

Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine. Read more...

Download

Download homestead box:

# Get the latest from GitHub, public repo:
$ npm install username/project-name --save-dev
# GitHub, private repo:
$ npm install git+https://token:x-oauth-basic@github.com/username/project-name.git#master
$ npm install git+ssh://git@github.com/username/project-name.git#master
# … or from Bitbucket, public repo:
$ npm install git+ssh://git@bitbucket.org/username/project-name.git#master --save-dev
# Bitbucket, private repo:
$ npm install git+https://username:password@bitbucket.org/username/project-name.git#master

Install Google Fonts

Download desired fonts

https://fonts.google.com/?selection.family=Open+Sans

Install Google Fonts on Ubuntu

cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
sudo unzip -d . ~/Downloads/Open_Sans.zip

date +%T -s "HH:MM:SS"
@iforwms
iforwms / post-merge
Created December 3, 2018 04:25
Git post merge hook for React Apps
#!/bin/bash
yarn
yarn build