Skip to content

Instantly share code, notes, and snippets.

View DevEarley's full-sized avatar
🎯
Focusing

Alex Earley DevEarley

🎯
Focusing
View GitHub Profile
@DevEarley
DevEarley / some-factory.js
Last active March 8, 2018 02:18
vm.Something = new Something();
angular.module('SomeApp').factory('SomeFactory',
function ($rootScope) {
var Something = function () {
this.Stuff = [];
this.AlertStuffLength = function () {
alert("This much Stuff: " + this.Stuff.length);
}
this.AddStuff = function (_stuff) {
this.Stuff.push(_stuff);
}
@DevEarley
DevEarley / css-transition.css
Last active October 18, 2017 20:44
Css Transition
transition: all 1s ease-in-out;
@DevEarley
DevEarley / angular-js-best-practices.md
Last active July 1, 2024 06:55
AngularJS (1.X) Best Practices and Naming Conventions

Angular Naming Convention

TYPE CONVENTION EXAMPLE
App Module UpperCamel MyApp
Controller UpperCamel SomeController
Service UpperCamel SomeDataService
Factory UpperCamel SomeFactory
Directive lowerCamel someDirective
Filter lowerCamel someFilter
@DevEarley
DevEarley / home-vs-code-settings.json
Last active March 3, 2018 19:03
My settings at home.
{
"window.menuBarVisibility": "toggle",
"workbench.activityBar.visible": false,
"workbench.iconTheme": "material-icon-theme",
"editor.roundedSelection": false,
"editor.minimap.enabled": true,
"editor.minimap.renderCharacters": false,
"editor.quickSuggestions": {
"other": true,
"comments": true,
@DevEarley
DevEarley / some-directive.js
Created March 8, 2018 02:15
Just some directive, doesn't do much.
angular
.module("someApp", [])
.directive("someDirective", function () {
return {
scope:{
someStringLiteral:"@",
someTwoWayBinding:"=",
someFunction:"&"
},
controllerAs:"vm",
@DevEarley
DevEarley / MessageManager.gd
Last active April 22, 2018 23:36
MessageManager for Godot
extends Node
export var node_paths = []
var player_node = null
var message_node = null
var nodes = []
func _ready():
message_node = get_node("../Message")
player_node = get_node("../Player")
for node_path in node_paths:
@DevEarley
DevEarley / angular-cli-commands.md
Last active February 20, 2019 04:06
Handful of commands for creating angular apps. Now with Yarn!
@DevEarley
DevEarley / angular-6-tips-n-tricks.md
Last active October 3, 2018 15:10
Angular Tips n' Tricks

This doc is using Angular 6 with Angular CLI.

Using ngModel

  1. Make sure to import FormsModule
	import { FormsModule, ReactiveFormsModule } from '@angular/forms';
	...
	@NgModule({
		imports: [
@DevEarley
DevEarley / angular-observables.md
Last active October 3, 2018 17:02
More Angular Tricks (Observables)

This doc is using Angular 6 with Angular CLI.

Using DEBOUNCE with ngModel

HTML

	<p>
		<input [(ngModel)]="txtQuery" (ngModelChange)="onFieldChange($event)"/>
		{{letterCount}}
	</p>
@DevEarley
DevEarley / subject-takeuntill.ts
Last active October 3, 2018 17:01
Best practice when using an observable...
this.titleService.emitterN$
.takeUntil(this.componentDestroyed$)
.subscribe(
(data: any) =>
{
// ... do something N
}
);
}