Skip to content

Instantly share code, notes, and snippets.

View tristanbailey's full-sized avatar
🏭
Talking to manufacturers

Tristan Bailey tristanbailey

🏭
Talking to manufacturers
View GitHub Profile
@tristanbailey
tristanbailey / respond-quickly.php
Last active August 29, 2015 14:27 — forked from ramsey/respond-quickly.php
Return a response to the client before processing anything
<?php
// Return our response as quickly as possible.
header('Connection: close');
ob_start();
header('HTTP/1.0 200 OK');
ob_end_flush();
flush();
@tristanbailey
tristanbailey / supervisord.sh
Created February 9, 2016 16:11 — forked from danmackinlay/supervisord.sh
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.

##Team Dropdown for Laravel Spark

Maybe you want a way for users to quickly jump to team settings?

Can be placed anywhere, try it out on user-right.blade.php Laravel Spark Team Dropdown

user()-&gt;currentTeam; ?&gt;

##Rotating Pricing Table for Laravel Spark

Can be placed anywhere, try it out on welcome.blade.php


Laravel Spark Pricing Table ###If you're using team plans just swap out $sparkPlans = Spark::plans(); with $sparkPlans = Spark::teamPlans();


@tristanbailey
tristanbailey / index.html
Last active April 25, 2016 07:49 — forked from anonymous/ONwBpO.markdown
Scroll up box
<html>
<head>
</head>
<body>
<div class="overlay">
<a href="#" class="overlay__title">Little teaser about the content</a>
<div class="overlay__content">
<div class="overlay__inner">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and s

UsedByTeams Model Trait For Laravel Spark

Automatically limit your models to the current team

So you're using spark, and you have teams enabled. You start creating models and want to have them be team specific. Instead of writing, Model::where('team_id', auth()->user()->currentTeam->id)->get(); use this trait to add that behind the scenes so that every time you call on your model, it's assumed that you mean for the current team.

This assumes that the model has a team_id, while it adds a scope of where team_id = currentTeam->id.


ServiceWorker for github pages

This is a ServiceWorker template to turn small github pages into offline ready app.

Why ?

Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an index.html file with all the nessesary CSS and JavaScript in it. I wanted to cache this html file so that I can access my tools offline as well.

Notes

Make sure your github pages have HTTPS enforced, you can check Settings > GitHub Pages > Enforce HTTPS of your repository.

@tristanbailey
tristanbailey / git-branch-status
Created September 18, 2016 09:22 — forked from jehiah/git-branch-status
show git ahead/behind info for branches
moved to github --> https://github.com/bill-auger/git-branch-status/
@tristanbailey
tristanbailey / docker-xenial-copy-paste.sh
Created October 13, 2016 19:17 — forked from BretFisher/docker-xenial-copy-paste.sh
Install Docker PPA on Ubuntu 16.04
# NOT FOR SHELL SCRIPT, but rather just for quick copy paste
# this is a copy-paste version with defaults of full shell script docker-xenial.sh
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
mkdir -p /etc/apt/sources.list.d && \
echo deb https://apt.dockerproject.org/repo ubuntu-xenial main > /etc/apt/sources.list.d/docker.list && \
service lxcfs stop && apt-get remove -y -q lxc-common lxcfs lxd lxd-client && \
apt-get update -q && apt-get upgrade -y -q && \
apt-get install -y -q linux-image-extra-$(uname -r) linux-image-extra-virtual && \
apt-get install -y -q docker-engine && \