Skip to content

Instantly share code, notes, and snippets.

@warlord0
warlord0 / VueTableCss.js
Created July 26, 2018 12:50
vuetables-2
// Deals with the sort icons using fontawesome
export default {
tableClass: 'table',
loadingClass: 'loading',
ascendingIcon: 'fas fa-arrow-down',
descendingIcon: 'fas fa-arrow-up',
detailRowClass: 'vuetable-detail-row',
handleIcon: 'fas fa-bars',
sortableIcon: '', //fas fa-sort-amount-up', // since v1.7
ascendingClass: 'sorted-asc', // since v1.7
@warlord0
warlord0 / AuthController.php
Last active July 26, 2018 11:29
AuthController for Laravel and Vue.js using JWTAuth
<?php
namespace App\Http\Controllers\VueAuth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use JWTAuth;
class AuthController extends Controller
@warlord0
warlord0 / scoRPIon.js
Created June 28, 2018 19:04
Raspberry Pi GPIO web server trigger for relay
const express = require('express')
const bodyParser = require('body-parser')
const gpio = require('gpio')
const app = express()
// Read the config from the .env file
require('dotenv').config()
// Setup the parameters using .env values or defaults
const port = process.env.PORT || 3000
@warlord0
warlord0 / ProcessUploads.php
Created June 28, 2018 08:02
Process BlueImp Uploaded Files
<?php
namespace App\Jobs\Gis;
use Log;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
@warlord0
warlord0 / emmet.html
Last active June 7, 2018 20:59
Emmet - example, bootstrap nav
<div id="app-navbar" class="collapse navbar-collapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item dropdown"><a href="" class="nav-link dropdown-toggle">
<div class="dropdown-menu">
<a href="" class="dropdown-item"></a>
<a href="" class="dropdown-item"></a>
<a href="" class="dropdown-item"></a>
<a href="" class="dropdown-item"></a>
<a href="" class="dropdown-item"></a>
</div>
@warlord0
warlord0 / ContractList.vue
Created March 17, 2018 11:26
Pagination issue with BootstrapVuew
<template>
<div>
<p class="alert alert-info"><i class="fa fa-info-circle"></i> Click on the contract for more detail.</p>
<b-table striped hover :items="contracts.data" :fields="fields"
:sort-by="sortBy" :sort-desc="sortDesc" no-local-sorting @sort-changed="sortChanged" />
<b-pagination :total-rows="contracts.total" :per-page="contracts.per_page"
@warlord0
warlord0 / DataTablesController.php
Created February 27, 2018 19:00
Laravel Controller snippet for Datatables.net json return values
/*
Provides data for a jquery DataTable call
*/
public function jsonDataTables(Request $request) {
$draw = 0;
$recordsTotal = MODEL::count();
$query = (new MODEL)->newQuery();
@warlord0
warlord0 / axios-formdata.js
Created February 27, 2018 15:40
Axios formdata
$('#form').on('submit', function(e) {
axios.put('/url', $(this).serialize())
.then(function(response) {
console.log(response);
})
.catch(function(error) {
console.log(error);
});
e.preventDefault();
});
@warlord0
warlord0 / app.axios.js
Last active March 6, 2018 10:48
Laravel Axios app.js
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
require('es6-promise').polyfill();
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
@warlord0
warlord0 / upload.blade.html
Last active February 23, 2018 10:20
Output from my Laravel file upload blade.
<main role="main" class="container">
<div class="card">
<div class="card-header">
<h4><i class="fa fa-upload"></i> Upload CSV Files <small>(drag and drop)</small></h4>
</div>
<div class="card-body">
<form method="GET" action="http://testserver/upload" accept-charset="UTF-8" class="uploadform" enctype="multipart/form-data">
<input class="form-control" name="_token" type="hidden" value="gHcZZlnXsPe3BZYns0u7CuSc8D51CE6gzHCflUhg">
<div class="col-12 mb-2">
<label for="file" class="control-label">Upload file</label>