Skip to content

Instantly share code, notes, and snippets.

Avatar
🍳
Living brunch to brunch.

Ezra Sharp nicekiwi

🍳
Living brunch to brunch.
View GitHub Profile
@nicekiwi
nicekiwi / AddyAddressLookupTest.php
Created December 5, 2019 06:19
Laravel Mockery
View AddyAddressLookupTest.php
<?php
namespace Tests\Feature;
use App\Services\Addy\Models\AddressDetails;
use GuzzleHttp\Client;
use Tests\TestCase;
class AddyAddressLookupTest extends TestCase
{
@nicekiwi
nicekiwi / gulpfile.babel.js
Created March 7, 2017 13:45
New ES6 project with Babel, Browserify & Gulp + Bundling/Watching Multiple Files
View gulpfile.babel.js
import gulp from 'gulp';
import sourcemaps from 'gulp-sourcemaps';
import buffer from 'gulp-buffer';
import uglify from 'gulp-uglify';
import tap from 'gulp-tap';
import browserify from 'browserify';
import babel from 'babelify';
gulp.task('build', () => {
View ufw-setup.sh
#!/bin/bash
apt-get -y update
# install the firewall
echo 'Installing UFW'
apt-get install -y ufw
echo 'Configuring UFW'
# disable IPv6
# sed -i "s/IPV6=yes/IPV6=no/" /etc/default/ufw
@nicekiwi
nicekiwi / blog-contactform.css
Last active December 26, 2015 09:58
CSS to power the frontend of my blog's contact form.
View blog-contactform.css
.response {
margin: 10px 0px;
padding:12px;
}
.response.success {
color: #4F8A10;
background-color: #DFF2BF;
}
@nicekiwi
nicekiwi / blog-contactform.js
Last active December 26, 2015 10:30
Code to power the frontend of my blogs Contact Form
View blog-contactform.js
$(document).ready(function () {
$('#contactForm').on('submit', function(event) {
// stop form submitting
event.preventDefault();
var form = $(this);
var button = form.find('button');
var responseBox = $('.response', form);
@nicekiwi
nicekiwi / ansible-playbook.yml
Created July 29, 2015 05:16 — forked from bhalothia/ansible-playbook.yml
register variables across plays
View ansible-playbook.yml
- vars:
# Extra vars from Rundeck for partition type
partition: "{{ partition }}"
# For 'nmctl ps' wrapper - Some deployment validation
number_of_tries: 5
sleep_between_tries: 60
hosts: "app-{{ partition }}[0]" # Canary
View gist:a8b7f8216b0bf959fcd5
/*
public function openPaymentPage(Request $request) {
$user_id = $request->json('user_id');
// how to redirect post another server with paramters?
// i cant find any solution with googling..
// is it possible?
return redirect()->to('http://myserver.com/testpost', compact('user_id'));
View nginx-install.sh
#!/bin/bash
nginx=stable # use nginx=development for latest development version
add-apt-repository ppa:nginx/$nginx
apt-get update -y
apt-get install -y nginx
echo "Nginx Installed"
@nicekiwi
nicekiwi / example
Last active August 29, 2015 14:22
Cache Model Example
View example
<?php
$usersWithComments = Cache::remember('users', $minutes, function()
{
return App\users::with('comments')->get();
});
// or
$users = App\users::with('comments')->get();
@nicekiwi
nicekiwi / example-queue.conf
Created May 28, 2015 04:29
Supervisor Laravel Queue Example
View example-queue.conf
[program:example-queue]
command=php artisan queue:work --queue=exmaple --tries=2 --daemon
directory=/var/www/example
stdout_logfile=/var/www/example/app/storage/logs/supervisor.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10
stdout_capture_maxbytes=0
stdout_events_enabled=false
// use 2 workers