Skip to content

Instantly share code, notes, and snippets.

View OwenMelbz's full-sized avatar

Owen Melbourne OwenMelbz

View GitHub Profile
@OwenMelbz
OwenMelbz / 1.install.md
Last active November 28, 2017 15:45
Critical CSS Scripts

Introduction

This is a very experimental script setup, feel free to modify, do what you wish, you'll need to take these instructions with a pinch of salt. Its designed to allow you to annotate css/scss/less etc files and then using postcss will generate *.critical.css files which can then be inlined using server side includes.

Installation

  1. Skim through the code, updating all the paths/folder structures etc to your requirements.
  2. Add the extra dependencies to your node setup
  3. run node split-critical.js - or add a script alias in your package.json for npm run criticalcss for example.
  4. This will generate a minified globals.critical.css for you to use via SSIs and any other tagged files
@OwenMelbz
OwenMelbz / DumpFullQueryMacro.php
Last active September 14, 2017 10:30
Dump Full Query Macro
<?php
/*
* Why
*
* If you're trying to debug queries sometimes its a pain to figure out if the actual
* query is correct as things like ->toSql dont provide the real values
* then ->getBindings returns objects like carbon etc which makes it hard.
*
* This tries to help by giving you a more realistic query output
@OwenMelbz
OwenMelbz / ContactServiceAPI.php
Last active November 6, 2017 16:22
HubSpot Contact Form
<?php
namespace Statamic\Addons\ContactService;
use Statamic\API\Email;
use Statamic\Extend\API;
class ContactServiceAPI extends API
{
@OwenMelbz
OwenMelbz / genesis_public_key
Created March 4, 2018 11:04
genesis_public_key
0480b54701ee78db62e2dd5d0657eb3b12c0cd1e1781025aadd9fa64856cb5f25cf799c3187e0189a84f199d67366ada4a352345a723fbb00565d334010cd0b598
@OwenMelbz
OwenMelbz / form.scss
Created May 1, 2018 16:39
Simple Form with Floating Labels
.input {
max-width: 100%;
padding: 5px 10px;
transition: border-color .2s ease;
border-radius: 0;
border-color: $black-1;
outline: none;
font-size: 16px;
-webkit-appearance: none;
@OwenMelbz
OwenMelbz / new nano.sh
Last active June 29, 2018 11:07
Pimp my Nano
curl https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh | sh
@OwenMelbz
OwenMelbz / datatables_logic.blade.php
Last active November 1, 2018 07:38
Backpack CRUD - Persistent Filters/Pages/Searches
<!-- DATA TABLES SCRIPT -->
<script src="{{ asset('vendor/datatables/js/jquery.dataTables.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/datatables/js/dataTables.bootstrap.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/datatables/js/responsive/dataTables.responsive.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('vendor/datatables/js/responsive/responsive.bootstrap.min.js') }}" type="text/javascript"></script>
<script>
var crud = {
enablePersistance: true,
route: 'DataTables_{{ trim($crud->getRoute(), '/') }}',
@OwenMelbz
OwenMelbz / aliases.sh
Created July 16, 2018 11:27
SSH Aliases
alias code='cd ~/Sites'
alias nah='git reset --hard;git clean -df;'
gogo() {
git add .
git commit -m "$(echo $@)"
git pull
git push
}
@OwenMelbz
OwenMelbz / pull-push.sh
Created August 1, 2018 13:22
Statamic sync
#!/bin/bash
# This folder page could change between environments - careful!
env=$1
if [[ $env == "prod" ]]; then
cd /home/forge/www.selesti.com
else
cd /home/forge/pink.selesti.com
fi
@OwenMelbz
OwenMelbz / NovaWatcher.js
Last active April 17, 2019 21:36
A single Laravel Mix for all your Nova components
const fs = require('fs');
const path = require('path');
module.exports = function NovaWatcher(context, component_path = null)
{
this.mix = context;
this.path = path.resolve(process.cwd(), (component_path || './nova-components'));
this.components = fs.readdirSync(this.path);