:%!xxd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Find and rename all the modules files according to the target environment | |
| env=${1-"dev"} | |
| dir="src/app/components" | |
| find $dir -name "*.$env.ts" -type f | while read file | |
| do | |
| base=$(basename $file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Array.prototype.mySum = function(callback) { | |
| const vals = this; | |
| const res = []; | |
| for (var i = 0; i < vals.length; i++) { | |
| res.push(callback(this[i])); | |
| } | |
| return res; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "package-name", | |
| "version": "0.0.0", | |
| "description": "package-name short description", | |
| "main": "lib/cli/index.js", | |
| "bin": { | |
| "package-name": "./bin/index.js" | |
| }, | |
| "scripts": { | |
| "test": "jest --watchAll" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright (c) 2018 AndreaSonny <[email protected]> (https://github.com/andreasonny83) | |
| // | |
| // This software is released under the MIT License. | |
| // https://opensource.org/licenses/MIT | |
| 'use strict'; | |
| const AWS = require('aws-sdk'); | |
| const ses = new AWS.SES(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Conditional value | |
| const a = { | |
| ...(someCondition && {b: 5}) | |
| } | |
| // Remove key from object | |
| const postData = { | |
| token: 'secret-token', | |
| publicKey: 'public is safe', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * The singleton pattern is a pattern used to restrict an object to a single instance. | |
| * A singleton creates an instance of an object if that object does not exist. | |
| * If it exists it returns the existing instance. | |
| */ | |
| class Car { | |
| constructor(model, year, miles) { | |
| if(Car.exists){ | |
| return Car.instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * The factory pattern abstracts object creation by providing an interface, where we can specify the type of | |
| * factory object to be created. | |
| * | |
| * The Factory pattern can be especially useful when applied to the following situations: | |
| * | |
| * - When our object or component setup involves a high level of complexity, | |
| * e.g. if it strongly depends on dynamic factors or application configuration. | |
| * - When we need to easily generate different instances of objects depending on the environment we are in | |
| * - When we're working with many small objects or components that share the same properties |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * The Facade pattern simplifies and hides the underlying complexity of a large abody of | |
| * code by providing a cleaner and easy to use interface. | |
| */ | |
| class TaskService { | |
| constructor(data){ | |
| this.name = data.name; | |
| this.priority = data.priority; | |
| this.project = data.project; |
ps aux | grep node
run top
find the process id (PID)
ps -efl | grep 10399
kill -9 10399