Skip to content

Instantly share code, notes, and snippets.

View kingsloi's full-sized avatar

Kingsley Raspe kingsloi

View GitHub Profile
@kingsloi
kingsloi / redactor(strip-tags-function-only).js
Last active August 29, 2015 14:15
Fix: Mangeto 1.9 CE - Redactor WYSIWYG Extention - Rejecting Paste from Microsoft Word
// REMOVE TAGS
stripTags: function(html)
{
// Redactor WYSIWYG editor refusing to accept pasted content from MS Word
// By Kingsley Raspe
// See: https://gist.github.com/kingsloi/97260c320bf22e5b96c7
var allowedObj = this.opts.allowedTags;
var allowed = '';
@kingsloi
kingsloi / Blog.php
Last active August 29, 2015 14:16
Mangeto 1.9 CE - aheadWorks Blog - Assign a Featured Product to a Blog post that appears in the sidebar
<?php
// add this to
// app/code/community/AW/Blog/Model/Blog.php
public function getFeaturedProductId()
{
$content = $this->getData('featured_product_id');
return $content;
}
#!/bin/sh -x
# ==================================
# iptables default configuration script
#
# - this locks down our servers port access
# ==================================
# install fail2ban
sudo apt-get update
@kingsloi
kingsloi / gulpfile.js
Created April 30, 2015 18:19
Laravel Elixir/Gulp
var elixir = require('laravel-elixir');
require('laravel-elixir-browsersync');
// PARAMS - is --production?
var inProduction = elixir.config.production;
// PATHS - Bower
var bower_path = "./resources/assets/bower";
@kingsloi
kingsloi / .jshintrc
Created May 5, 2016 19:13
JsFormat.sublime-settings
{
/*
* ENVIRONMENTS
* =================
*/
"globals": {
"localStorage": false,
"document": false,
"confirm" :false,
@kingsloi
kingsloi / [1] main.js
Created February 15, 2017 14:49 — forked from hfalucas/[1] main.js
[Vue.js] Authentication and Authorization
/**
* 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'

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 / curl.sh
Last active September 28, 2017 21:14
HAYO
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>'
@kingsloi
kingsloi / installation.sh
Last active December 5, 2017 23:56
HAYO
# Download
composer global require heyareyouonline/hayo
# Register
hayo register <token>
# Usage
hayo online # Go online
hayo offline # Go offline
hayo heartbeat # Send single heartbeat
@kingsloi
kingsloi / rpi-gpio-epaper-full-picture.js
Created January 5, 2018 23:26 — forked from dbushell/rpi-gpio-epaper-full-picture.js
rpi-gpio-epaper full picture example
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() {