Skip to content

Instantly share code, notes, and snippets.

View lukecurtis93's full-sized avatar

Luke Curtis lukecurtis93

View GitHub Profile
//: Playground - noun: a place where people can play
import Foundation
import XCPlayground
import PlaygroundSupport
import UIKit
struct Industry: Codable {
let name: String
let id: Int
@lukecurtis93
lukecurtis93 / JSONtoDictionaryAPIwithHeaders.swift
Created January 25, 2018 16:59
JSON, Swift, HTTP Headers and API’s
//: Playground - noun: a place where people can play
import Foundation
import XCPlayground
import PlaygroundSupport
import UIKit
struct Industry: Codable {
let name: String
let id: Int
@lukecurtis93
lukecurtis93 / TestController.php
Last active February 7, 2019 11:08
A Laravel Throttle Job Example
<?php
namespace App\Http\Controllers;
use App\Jobs\TestJob;
use Illuminate\Http\Request;
class TestController extends Controller
{
//
@lukecurtis93
lukecurtis93 / Debounce.vue
Created February 18, 2019 08:25
A Vue debounce example leveraging Lodash
<template>
<div>
<div class="col-md-6 vertical-center" v-for="(user, index) in users" :key="index">
<input type="text" @input="updateUsername(user)" class="form-control" v-model="user.name">
</div>
</div>
</template>
<script>
export default {
data() {
@lukecurtis93
lukecurtis93 / AddressSort.php
Created February 25, 2019 12:38
Laravel Full Text Search with JSON, using spatie schemaless attributes and query builder
<?php
namespace App\Filters\Sorts;
use Spatie\QueryBuilder\Sorts\Sort;
use Illuminate\Database\Eloquent\Builder;
class AddressSort implements Sort
{
public function __invoke(Builder $query, string $property) : Builder
@lukecurtis93
lukecurtis93 / Post.php
Created April 1, 2019 09:35
Simple Geosearch in Laravel
/**
* Scope to query the database to return the listings between
* a latitude and longitude, with distance.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param Double $lat
* @param Double $lng
* @param Integer $radius - KM
* @return \Illuminate\Database\Eloquent\Builder
*/
@lukecurtis93
lukecurtis93 / PaginatedTable.vue
Last active February 11, 2020 14:50
The reusable pagination component
<template>
<div class="jem-paginated-table">
<div class="jem-table-controls w-100">
<div v-if="tableData.showSearch" class="w-100">
<div class="p-3 w-100 d-flex align-items-center">
<div class="input-group" style="max-width: 250px;">
<input
class
style="max-width: 250px;"
v-model="query"
@lukecurtis93
lukecurtis93 / CompanyIndex.vue
Last active July 11, 2019 22:53
A usage example of the paginated table with Vue Api Query
<template>
<paginated-table
v-if="companies.data"
:tableData="tableData"
:paginatedData="companies"
@pagination-change-page="getCompanies"
/>
</template>
<script>
@lukecurtis93
lukecurtis93 / SendXeroInvoice.php
Created July 11, 2019 07:16
Send an invoice to Xero in Laravel Job
<?php
namespace App\Jobs\Xero;
use File;
use DateTime;
use App\Models\Invoice;
use Illuminate\Bus\Queueable;
use Spatie\Browsershot\Browsershot;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
@lukecurtis93
lukecurtis93 / Kernel.php
Created August 23, 2019 01:32
Webhooks with Laravel
<?php
namespace App\Http;
class Kernel extends HttpKernel
{
/** More code above */
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,