Skip to content

Instantly share code, notes, and snippets.

View kingsloi's full-sized avatar

Kingsley Raspe kingsloi

View GitHub Profile
@kingsloi
kingsloi / generate-select-for-bootstrap-tabs.js
Last active March 25, 2018 04:59
Generate <select> drop down boxes for Twitter Bootstrap tabs (.nav-tabs) - jsfiddle: http://jsfiddle.net/kingsloi/96ur6epu/
$(document).ready(function(){
//set the index counter
var i = 0;
//convert all .nav-tabs, except those with the class .keep-tabs
$('.nav-tabs').not( ".keep-tabs" ).each(function(){
//init variables
var $select,
@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 / PermissionServiceProvider.php
Created June 27, 2016 16:07
Spatie's Laravel Permission fix for registering Blade directives in Laravel 5.2
<?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 / AnyPage.vue
Created January 14, 2017 01:33
Vue 2 - VueRouter - Simple Dynamic breadcrumbs + Microdata
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 / [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' => [