Skip to content

Instantly share code, notes, and snippets.

View tonyjoanes's full-sized avatar
🤡
Focusing

Tony Joanes tonyjoanes

🤡
Focusing
View GitHub Profile
@tonyjoanes
tonyjoanes / AngularJS_Services.js
Created October 21, 2019 11:23
AngularJS Services
(function () {
'use strict';
var serviceId = 'myService';
angular.module('app', serviceId);
myService.$inject = ['dependencyOne', 'dependencyTwo'];
function myService(
@tonyjoanes
tonyjoanes / angularjs_controllers3.js
Created October 18, 2019 14:12
AngularJS Controllers function declaration at the top
(function () {
'use strict';
var MyController = function (dependencyOne, dependecyTwo) {
var vm = this;
vm.data = {
greetingMessage: 'Hello I am some data from the controller',
clickHandler: dependecyOne.click
}
@tonyjoanes
tonyjoanes / angularjs_controllers2.js
Last active October 18, 2019 14:14
AngularJS Controllers using $inject
(function () {
'use strict';
angular
.module('app')
.controller('MyController', MyController);
MyController.$inject = ['dependencyOne', 'dependecyTwo'];
function MyController(
(function () {
'use strict';
// Define the dependencies within an array and have a
// separate clean function for the controller code
angular
.module('app')
.controller('MyController'[
'dependecyOne',
'dependecyTwo',
// working d. bodnar 12-21-2017
/*
static const uint8_t D0 = 16;
static const uint8_t D1 = 5;
static const uint8_t D2 = 4;
static const uint8_t D3 = 0;
static const uint8_t D4 = 2;
static const uint8_t D5 = 14;
static const uint8_t D6 = 12;
function getWatchers(root) {
root = angular.element(root || document.documentElement);
var watcherCount = 0;
function getElemWatchers(element) {
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope);
var scopeWatchers = getWatchersFromScope(element.data().$scope);
var watchers = scopeWatchers.concat(isolateWatchers);
angular.forEach(element.children(), function (childElement) {
watchers = watchers.concat(getElemWatchers(angular.element(childElement)));
@tonyjoanes
tonyjoanes / AngularJS_Chrome_Snippets.js
Created September 26, 2018 09:45
Chrome Snippets for AngularJS
/**
* Setup the angular injector so we can get instances
* of angular objects
* Usage: injector.get('dataContext');
*/
var injector = angular
.element(document.body)
.injector();
/**

ObjectCalisthenicsKata1

Coding kata using object calisthenics rules

  • Only One Level Of Indentation Per Method
  • Don't Use The ELSE Keyword
  • Wrap All Primitives And Strings
  • First Class Collections
  • One Dot Per Line
  • Don't Abbreviate
  • Keep All Entities Small
@tonyjoanes
tonyjoanes / build.proj
Created February 16, 2016 14:28
Build file that points to Nuget.exe and performs a restore
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutDir Condition=" '$(OutDir)'=='' ">$(MSBuildThisFileDirectory)bin\</OutDir>
<Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
<SourceHome Condition=" '$(SourceHome)'=='' ">$(MSBuildThisFileDirectory)</SourceHome>
<ToolsHome Condition=" '$(ToolsHome)'=='' ">$(MSBuildThisFileDirectory)tools\</ToolsHome>
@tonyjoanes
tonyjoanes / nuget.config
Created February 16, 2016 14:26
Nuget config file to disable source control integration
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>