Skip to content

Instantly share code, notes, and snippets.

Avatar

Kingsley Raspe kingsloi

View GitHub Profile
@kingsloi
kingsloi / pug-bomb.php
Created Dec 15, 2018 — forked from inspectorfegter/pug-bomb.php
Pug Bomb API Endpoint WordPress Plugin
View pug-bomb.php
<?php
/*
Plugin Name: Pug Bomb API Endpoint
Description: Adds an API endpoint at /api/pugs/$n_pugs
Version: 0.1
Author: Brian Fegter
Author URL: http://coderrr.com
*/
class Pugs_API_Endpoint{
@kingsloi
kingsloi / PageController.php
Last active Nov 29, 2018 — forked from jeffochoa/EloquentSortableServiceProvider.php
Persistent Laravel filtering, pagination and column sorting link generation using macros
View PageController.php
// Http/Controllers/PageController.php
public function index() {
$users = Page::sort()->paginate(10)->appends(request()->query());
return view('pages', compact('pages'));
}
View rpi-gpio-epaper-full-picture.js
const fs = require('fs');
const PNG = require('pngjs').PNG;
const EPD = require('rpi-gpio-epaper');
function readImage(imagePath) {
return new Promise((resolve, reject) => {
fs
.createReadStream(imagePath)
.pipe(new PNG())
.on('parsed', function() {
View curl.sh
curl -X GET \
https://heyareyou.online/api/kingsley.raspe \
-H 'cache-control: no-cache'
# Response:
# {"status":"online","lastReceived":1505584946,"expiryDate":1505585245}
curl -X POST \
https://heyareyou.online/api/heartbeat \
-H 'authorization: Bearer <token>'
View installation.sh
# Download
composer global require heyareyouonline/hayo
# Register
hayo register <token>
# Usage
hayo online # Go online
hayo offline # Go offline
hayo heartbeat # Send single heartbeat
View Laravel Spark Per Team User Subscription.md

Per Team User Subscription in Laravel Spark

If you want the ability to charge a team owner based on how many members their team has, like $10/user/month, then you utilize the Laravel Cashier functionality of incrementing the quantity.

You listen for when a new team member is added and you increase the quantity of the subscription by the amount of users and also listen for when a team member is removed to downsize charges. - Not Braintree Compatible


Within EventServiceProvider.php
'Laravel\Spark\Events\Teams\TeamMemberAdded' => [
@kingsloi
kingsloi / [1] main.js
Created Feb 15, 2017 — forked from hfalucas/[1] main.js
[Vue.js] Authentication and Authorization
View [1] main.js
/**
* Think of this "main.js" file as your application bootstrap.
*/
import Vue from 'vue'
import Resource from 'vue-resource'
import VueRouter from 'vue-router'
import routes from './routes'
import middleware from './middleware'
@kingsloi
kingsloi / AnyPage.vue
Created Jan 14, 2017
Vue 2 - VueRouter - Simple Dynamic breadcrumbs + Microdata
View AnyPage.vue
export default {
beforeRouteEnter(route, redirect, next) {
next(vm => {
vm.$http.get(`${API.BASE}/${API.PAGE}/${route.name}`).then((response) => {
vm.page = response.data.page;
vm.eventHub.$emit('update-breadcrumb', [
{
title: 'Home',
@kingsloi
kingsloi / PermissionServiceProvider.php
Created Jun 27, 2016
Spatie's Laravel Permission fix for registering Blade directives in Laravel 5.2
View PermissionServiceProvider.php
<?php
namespace Spatie\Permission;
use Blade;
use Illuminate\Support\ServiceProvider;
use Spatie\Permission\Contracts\Permission as PermissionContract;
use Spatie\Permission\Contracts\Role as RoleContract;
class PermissionServiceProvider extends ServiceProvider
@kingsloi
kingsloi / .jshintrc
Created May 5, 2016
JsFormat.sublime-settings
View .jshintrc
{
/*
* ENVIRONMENTS
* =================
*/
"globals": {
"localStorage": false,
"document": false,
"confirm" :false,
You can’t perform that action at this time.