Skip to content

Instantly share code, notes, and snippets.

View nicklaw5's full-sized avatar
🏠
Working from home

Nick Law nicklaw5

🏠
Working from home
View GitHub Profile
@nicklaw5
nicklaw5 / laravel-nginx-server-block
Last active May 22, 2016 06:35
A default server block for configuring a host or domain in NGINX
server {
listen 80;
listen 443 ssl;
server_name api.exampel.com;
root "/home/vagrant/Code/stryve-api/public";
index index.html index.htm index.php;
charset utf-8;
@nicklaw5
nicklaw5 / flag.go
Last active October 14, 2016 22:28
Go question
// file exists in go-ku/flag/flag.go
package flag
import "flag"
// Flagset inherits the default FlagSet
type Flagset struct {
*flag.FlagSet
}
@nicklaw5
nicklaw5 / .env.travis
Created January 4, 2017 22:03 — forked from gilbitron/.env.travis
Laravel 5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
@nicklaw5
nicklaw5 / await-async.js
Created January 20, 2017 19:48 — forked from MichalZalecki/await-async.js
Run generators and and await/async
import axios from "axios";
export default async function () {
const { data: { id } } = await axios.get("//localhost:3000/id");
const { data: { group } } = await axios.get("//localhost:3000/group");
const { data: { name } } = await axios.get(`//localhost:3000/${group}/${id}`);
console.log(name); // Michał
}
@nicklaw5
nicklaw5 / slim-example.md
Created February 24, 2017 23:58
slim example

directory structure:

/my-project
  /public
     index.php
  /src
     /Controllers
        UsersController.php
  /test
@nicklaw5
nicklaw5 / vm-resize-hard-disk.md
Created March 16, 2017 07:00 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@nicklaw5
nicklaw5 / Select.js
Created July 19, 2017 19:24
Select.js
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import ReactSelect from 'react-select'
class Select extends Component {
constructor(props) {
super(props)
this.state = {
name: this.props.name,
value: this.props.value,
@nicklaw5
nicklaw5 / SelectFormGroup.js
Created July 19, 2017 19:25
SelectFormGroup.js
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Select from '../elements/Select'
class SelectFormGroup extends Component {
constructor(props) {
super(props)
this.state = {
name: this.props.name,
label: this.props.label,
@nicklaw5
nicklaw5 / RequestQuoteForm.js
Created July 19, 2017 19:26
RequestQuoteForm.js
import React, { Component } from 'react'
import FormData from './RequestQuoteData'
import ButtonGroup from './groups/ButtonGroup'
import InputFormGroup from './groups/InputFormGroup'
import SelectFormGroup from './groups/SelectFormGroup'
import DatepickerFormGroup from './groups/DatepickerFormGroup'
class RequestQuoteForm extends Component {
constructor(props) {
super(props)
@nicklaw5
nicklaw5 / filebeat.yml
Last active June 25, 2019 14:10
Logstash & Filebeat configuration for parsing MariaDB Slow Logs
#=========================== Filebeat prospectors =============================
filebeat.prospectors:
- input_type: log
document_type: mariadb-slowlogs
paths:
- "/var/log/mysql/mariadb-slow.log"
multiline:
pattern: '^# User@Host: '
negate: true
match: after