Skip to content

Instantly share code, notes, and snippets.

View wizardnet972's full-sized avatar
:octocat:
Angularing...

Shlomi Levi wizardnet972

:octocat:
Angularing...
View GitHub Profile
@wizardnet972
wizardnet972 / nginx-aws
Created January 11, 2018 14:44
install nginx on aws ubuntu (by wizardnet972)
(by wizardnet972)
sudo wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
cd /etc/apt
sudo nano sources.list
> appending this text at the end:
sudo apt-get update
sudo apt-get install libssl-dev g++ make
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
. ~/.nvm/nvm.sh
nvm install node
default-image.directive.ts:
import { Directive, Input, HostListener, ElementRef } from '@angular/core';
@Directive({
selector: 'img[default]',
})
export class DefaultImageDirective {
@Input() default: string;
helper.ts:
export const HelperMethod = () => {
return {};
};
app.ts:
import { HelperMethod } from './helper';
require('zone.js/dist/zone-node');
Zone.current.fork({
onHandleError:
(parentZoneDelegate, currentZone, targetZone,
error) => {
console.log('should be error here', error);
// return parentZoneDelegate.handleError(targetZone, error);
}
router.all('/incaseoferror', async(req, res, next) => {
const promise = await new Promise(function (resolve, reject) {
setTimeout(function () {
reject(new Error('this is a test err'));
}, 3000);
});
This file has been truncated, but you can view the full file.
{
"status": "ok",
"results_time": "12.0041 sec.",
"results_count": 701,
"results": [
{
"key": "baby clothes",
"cmp": 0.9990850304818497,
"cpc": 1.188172,
"sv": 110000,
@wizardnet972
wizardnet972 / *.md
Created March 5, 2017 06:17
Component versus Directive in AngularJS

Component versus Directive in AngularJS

.component()

Components are not "helper" methods, they are the best change in Angular 1.x since I've been using it.

What is the role of .component()?

  • Declares new HTML via a template or templateUrl
  • Should be used to create Components as part of a Component architecture

@ngrx/store v3

Problems:

  • Users want to compose reducer tree across modules
  • Idea of a single reducer function makes it difficult for the library to dynamically augment the shape of the state tree
  • Turning control over to the library to build the root reducer limits the use of meta-reducers
  • Feature modules may inadvertently collide with the state of the root module
  • Library authors may want to leverage @ngrx/store in their projects and provide an easy way
@wizardnet972
wizardnet972 / gist:36c5d412295b0b791e9f757e3fd5ab0d
Created January 9, 2017 16:07
JavaScript, Inheritance: John Resig Simple Inheritance
/* Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
*/
// Inspired by base2 and Prototype
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;