Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathaniel Hammond nfourtythree

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am nfourtythree on github.
  • I am nfourtythree (https://keybase.io/nfourtythree) on keybase.
  • I have a public key ASAfA_JXe8rgAyut9301GxHvL7NSUDZGX2qNLKGdwHXC1Qo

To claim this, I am signing this object:

@nfourtythree
nfourtythree / Password Protect Serverpilot App.md
Last active Dec 10, 2020
Password Protect Serverpilot App
View Password Protect Serverpilot App.md

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

ssh SERVERPILOTUSERNAME@your.server.ip.address

2. Create a htpasswd file in your app

@nfourtythree
nfourtythree / How To Disable Strict SQL Mode in MySQL 5.7.MD
Last active Apr 29, 2021
Serverpilot - Disable Strict SQL Mode in MySQL 5.7
View How To Disable Strict SQL Mode in MySQL 5.7.MD

How To Disable Strict SQL Mode in MySQL 5.7

I wrote a quick script for those that provision servers often enough.

To get this to work take the following steps

  1. Log into your server as root
  2. Get script wget https://gist.githubusercontent.com/nfourtythree/90fb8ef5eeafdf478f522720314c60bd/raw/disable-strict-mode.sh
  3. Make is executable chmod +x disable-strict-mode.sh
  4. Run the script ./disable-strict-mode.sh
@nfourtythree
nfourtythree / CraftValetDriver.php
Last active Aug 4, 2016 — forked from martinleveille/CraftLocaleValetDriver.php
Laravel Valet driver for Craft CMS simple with document root (no locales)
View CraftValetDriver.php
<?php
class CraftLocaleValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
@nfourtythree
nfourtythree / index.js
Created Jun 29, 2016
generator-craftinstall
View index.js
/* --------------------------------------------------------------------------------
GENERATOR-NYSTUDIO107
generator-nystudio107 is a Yeoman generator for Craft CMS installs
Type just `yo nystudio107` and a new Craft CMS project install tailored to
your liking will be created.
-------------------------------------------------------------------------------- */
'use strict';
@nfourtythree
nfourtythree / enable_dnsmasq_on_osx.sh
Last active May 10, 2016 — forked from r10r/enable_dnsmasq_on_osx.sh
Installs and configures dnsmasq on osx (for local resolution of development machines e.g virtualbox). Cudos to Alan Ivey http://www.echoditto.com/blog/never-touch-your-local-etchosts-file-os-x-again
View enable_dnsmasq_on_osx.sh
# ----------------------
# installing dnsmasq and enable daemon
# ----------------------
brew install dnsmasq
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
# ----------------------
# adding resolver for dev domain
# ----------------------
[ -d /etc/resolver ] || sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev'
@nfourtythree
nfourtythree / db.php
Last active May 11, 2016
Craft Environments Setup
View db.php
<?php
/**
* Database Configuration
*
* All of your system's database configuration settings go in here.
* You can see a list of the default settings in craft/app/etc/config/defaults/db.php
*/
return array(
@nfourtythree
nfourtythree / custom.js
Created Mar 1, 2016
Everhour / Trello - Tracked Time and Estimate Time List totals
View custom.js
function throttle(fn, threshhold, scope) {
threshhold || (threshhold = 250);
var last,
deferTimer;
return function () {
var context = scope || this;
var now = +new Date,
args = arguments;
if (last && now < last + threshhold) {
@nfourtythree
nfourtythree / craft date ids bug.twig
Last active Aug 29, 2015
Bug in Craft CMS when using dateUpdated or dateCreated and .ids()
View craft date ids bug.twig
{# Setup Data #}
{% set stuff = craft.entries({
section: "mySection",
order: "dateUpdated ASC",
}) %}
{# Retrieve Ids #}
{% set ids = stuff.ids() %}
{#
View craft service extend
// Base service in plugin
namespace Craft;
class Plugin_baseService extends BaseApplicationComponent
{
...
// Extended service in plugin
namespace Craft;