Skip to content

Instantly share code, notes, and snippets.

View DavidVotrubec's full-sized avatar

David Votrubec DavidVotrubec

View GitHub Profile
@ThomasBurleson
ThomasBurleson / Guide-to-Custom-Nx-Schematic.md
Last active June 15, 2023 13:32
Custom Nx workspace schematic to build a custom 'state' library.

Scenario

We want to build a custom schematic for company Aero that will internally do two things:

  • build a new ngrx library using Nx workspace naming conventions
  • generate ngrx state-management files; include the *.facade.* files

Important: This example is valid ONLY for Nx v6.2.x or higher!

const log = new Proxy({}, {
get: (_, colour) => function() {
console.log(`%c ${[].slice.call(arguments).join(' ')}`, `color: ${colour}`)
}
})
// example
log.tomato('I am tomato')
log.chocolate('I am chocolate')
log.cornflowerblue('I am cornflowerblue')
@ospaarmann
ospaarmann / my.component.ts
Created August 23, 2016 10:56
Angular 2 nl2br pipe
import { Component} from '@angular/core';
import { Nl2BrPipe } from './nl2br.pipe';
@Component({
moduleId: module.id,
selector: 'my-component',
template: `
<div [innerHtml]="content | nl2br"></div>
`
app.directive('someDirective', function () {
return {
scope: {
oneWay: '@',
twoWay: '=',
expr: '&'
}
};
});
@ultimatemonty
ultimatemonty / nl2br.js
Created December 4, 2014 21:41
Ember nl2br helper
Ember.Handlebars.registerBoundHelper('nl2br', function (text) {
var breakTag = '<br />';
return new Handlebars.SafeString((text + '')
.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2'));
});
@staltz
staltz / introrx.md
Last active November 19, 2024 13:42
The introduction to Reactive Programming you've been missing
@BobNisco
BobNisco / controller.js
Last active February 27, 2023 15:43
onLongPress AngularJS Directive - Great for mobile!
// Somewhere in your controllers for this given example
// Example functions
$scope.itemOnLongPress = function(id) {
console.log('Long press');
}
$scope.itemOnTouchEnd = function(id) {
console.log('Touch end');
}