Skip to content

Instantly share code, notes, and snippets.


Nigel James njames

View GitHub Profile
View maths.ahk
; -------------------------------------------------
; Symbol and their Descriptions
; # Win (Windows logo key)
; ! Alt
; ^ Ctrl
; + Shift
; & An ampersand may be used between any two keys or mouse buttons to combine them into a custom hotkey.
; ------------------------------------------------
; Set the Icon for the script

UsedByTeams Model Trait For Laravel Spark

Automatically limit your models to the current team

So you're using spark, and you have teams enabled. You start creating models and want to have them be team specific. Instead of writing, Model::where('team_id', auth()->user()->currentTeam->id)->get(); use this trait to add that behind the scenes so that every time you call on your model, it's assumed that you mean for the current team.

This assumes that the model has a team_id, while it adds a scope of where team_id = currentTeam->id.

Note: Implicit Route Model Binding in 5.2, auth session doesn't exist at the point of this trait causing issue. fixed in 5.3

View Spark User Team

Seeding Users & Teams In Laravel Spark

Makes 5 users each with 1 team that has 5 members

Add a team factory to database/factories/ModelFactory.php

$factory->define(App\Team::class, function (Faker\Generator $faker) {
    return [
 'name' => $faker->sentence,
QuantumGhost / example.puml
Last active Nov 26, 2022
A simple template for PlantUML to draw ER diagram.The basic idea comes from
View example.puml
' uncomment the line below if you're using computer with a retina display
' skinparam dpi 300
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >>
' we use bold for primary key
' green color for unique
' and underscore for not_null
!define primary_key(x) <b>x</b>
!define unique(x) <color:green>x</color>
!define not_null(x) <u>x</u>
mitsuruog / bind.js
Last active Apr 6, 2018
multiple property databinding on SAPUI5
View bind.js
new sap.m.Text({
text: {
parts: [
{path: "Width"},
{path: "Depth"},
{path: "Height"},
{path: "DimUnit"}
formatter: function(width, depth, height, dimUnit){
return width + " x " + depth + " x " + height + " " + dimUnit;
whatnickcodes / base64.js
Created Apr 24, 2014
How to Encode and Decode Strings with Base64 in JavaScript
View base64.js
// Create Base64 Object
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r
rothgar / main.yml
Last active Nov 25, 2022
Generate /etc/hosts with Ansible
View main.yml
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
denji /
Last active Nov 23, 2022
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
JDMcKinstry / apiCCB.php
Last active Jul 22, 2019
Simple PHP class for interacting with the Church Community Builder (CCB) API.
View apiCCB.php
* class apiCCB
* @author Jeremiah D. McKinstry <>
* @date Wednesday, August 14, 2013
* @version 1.0.0
* @see
* @copyright This class is free: you can redistribute it and/or modify
elsewhat /
Created Jul 26, 2013
Get latest SAPUI5 for eclipse update site
echo "1. Download the main file from the eclipse update site"
wget --no-check-certificate
echo "2. Unzip the content.jar to content.xml (and delete content.jar)"
unzip content.jar
rm content.jar
echo "3. Generate urls for the components to fetch"