Skip to content

Instantly share code, notes, and snippets.

View russellf9's full-sized avatar
🏠
Working from home

Russell Wenban russellf9

🏠
Working from home
  • Factornine Limited
  • London, UK
View GitHub Profile
'use strict';
/*
* A Service which injects either a Mock or Live Service to implement the CRUD AJAX Calls
*
* For reference
* See: http://phonegap-tips.com/articles/conditional-dependency-injection-with-angularjs.html
*
*/
@russellf9
russellf9 / backButton.dir.js
Created December 15, 2014 12:29
Back Button
'use strict';
/**
* A simple directive to use the browser history to implement `back` behaviour
*/
tool.directive('backButton', ['$window', function ($window) {
return {
restrict: 'A',
@russellf9
russellf9 / localStorage.dir.js
Created December 23, 2014 15:35
Schedule App
'use strict';
/**
* A directive to handle local storage
*/
tool.directive('storage', ['$log', '$modal', 'storageSVC', 'locationSVC', function($log, $modal, storageSVC, locationSVC) {
return {
restrict: 'EA',
@russellf9
russellf9 / .jscsrc
Created January 18, 2015 18:30
A default config file for JavaScript Code Style - JSCS
{
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch", "case", "default"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireParenthesesAroundIIFE": true,
"requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true },
"disallowSpacesInFunctionExpression": { "beforeOpeningRoundBrace": true },
"requireMultipleVarDecl": true,
"disallowEmptyBlocks": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideArrayBrackets": true,
@russellf9
russellf9 / .jshintrc
Created February 26, 2015 16:08
A default config file for JavaScript Linting jshintrc
{
"globalstrict": true,
"globals": {
"this" : false,
"localStorage": false,
"angular": true,
"Firebase": true,
"Modernizr": true,
"moment" : true,
"tool" : true,
@russellf9
russellf9 / escapeHtmlEntities.js
Created March 16, 2015 11:35
A function to escape HTML entities
// see: http://stackoverflow.com/questions/1354064/how-to-convert-characters-to-html-entities-using-plain-javascript
// TODO move to $filters
var escapeHtmlEntities = function(text) {
return text.replace(/[\u00A0-\u2666<>\&]/g, function(c) {
return '&' +
(escapeHtmlEntities.entityTable[c.charCodeAt(0)] || '#' + c.charCodeAt(0)) + ';';
});
};
// the wrong kind of entities for our purpose but worth keeping
@russellf9
russellf9 / angular-directive-tmpl.xml
Last active August 7, 2016 19:51
A Webstorm Live Template, which generates an Angular 1 Directve with a Controller.
<template name="ngsd" value="(function () {&#10;&#10; 'use strict';&#10;&#10;&#10; /**&#10; *&#10; * @author $name$&#10; * @date $date$&#10; *&#10; * @name&#10; * $module$:$directiveName$&#10; *&#10; * @param {data} $input1$ An input two-way binding&#10; * @param {function} $function1$ An output function&#10; * &#10; * @description $description$&#10; * Trying to follow the style guidelines from: {https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#angular-docs Angular 1 Style Guide &lt;br&gt;&#10; * @example&#10; &lt;pre&gt;&#10; &lt;$nameDash$&#10; $inputDash1$='data'&#10; $functionDash1$='update'&gt;&#10; &lt;$nameDash$/&gt;&#10; &lt;pre&gt;&#10; *&#10; */&#10;&#10; try {&#10; module = angular.module('$module$');&#10; } catch (err) {&#10; module = angular.module('$module$', [])&#10; }&#10; &#10; module.directive('$directiveName$', $directiveNa
@russellf9
russellf9 / angular-factory-tmpl.xml
Created July 31, 2016 09:53
A IntelliJ Live Template to create an Angular Factory Service
<template name="ngf" value="(function () {&#10;&#10; 'use strict';&#10;&#10;&#10; /**&#10; *&#10; * @author $name$&#10; * @date $date$&#10; *&#10; * @name&#10; * $module$:$factoryName$&#10; *&#10; * @param {obj} $value1$ An accessible member&#10; * @param {function} $function1$ A function the Factory returns&#10; * @param {function} $function2$ A function the Factory returns&#10; *&#10; * // define module requirements&#10; * @requires $dependancy1$&#10; * @requires $dependancy2$&#10; *&#10; * // define `imports`&#10; * @requires $import1$&#10; * @requires $import2$&#10; * &#10; * @description $description$&#10; * Trying to follow the style guidelines from: {https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#angular-docs Angular 1 Style Guide &lt;br&gt;&#10; *&#10; */&#10; &#10; // Ideally each Directive will have a unique package, so this try, catch won`t be required &lt;br&gt;&#10;
@russellf9
russellf9 / mysql-setup-mac-with-sequel-pro.md
Created July 9, 2021 13:57 — forked from joeyklee/mysql-setup-mac-with-sequel-pro.md
Setting up mysql on mac with sequel pro and homebrew

Setup instructions

Setting up mysql on mac with sequel pro and homebrew

MacOS high sierra 10.13.6
Homebrew version 1.7.6

Assuming you've installed homebrew...