Skip to content

Instantly share code, notes, and snippets.

Avatar
🏗️
Developing...

Safi myuseringithub

🏗️
Developing...
View GitHub Profile
@myuseringithub
myuseringithub / gist:167319cb33c25e96194d12554349a031
Created Oct 9, 2019
Powershell - compare commandline path to current executed script path
View gist:167319cb33c25e96194d12554349a031
# Must be executed from the root path of the git repository.
$commandlineCurrentPath = pwd # Get-Location equivalent
$currentExecutedScriptPath = $PSScriptRoot
$parentOfCurrentExecutedScriptPath = Split-Path -Path $currentExecutedScriptPath -Parent
if(-Not ($parentOfCurrentExecutedScriptPath -eq $commandlineCurrentPath) ){
$message = "Error ! This script must be executed from the root path of the git repository, as it needs to verify path of WSL scripst executed from it."
Write-Host $message -ForegroundColor Red -BackgroundColor Black
pause
break
}
@myuseringithub
myuseringithub / nodeInclude
Created Feb 25, 2019
Execute file code as if written locally.
View nodeInclude
const include = (file) => { eval(filesystem.readFileSync(file) + '') }
View - Docker Machine
docker-machine ls
docker-machine rm -f <specificNodeName>
docker-machine ssh <VMName>
# send commands to the docker daemon of the following vm:
eval $(docker-machine env <VMName>)
# in case some problems appear regarding certificates
docker-machine regenerate-certs <machineName>
# Open ports of docker-machine
View How_Require_Extensions_Work.md

Why

Doing require extensions correctly is essential, because:

  1. Users should be able to install multiple extensions in succession, and have them work together.
  2. Coverage tools like nyc need it to reliably supply coverage information that takes into account sourcemaps from upstream transforms.
  3. Because non-standard, un-predictable behavior causes hard to solve bugs, and major headaches for project maintainers.

What is a require extension anyways?

View extendsFunctionConstructor
// https://www.accelebrate.com/blog/javascript-es6-classes-and-prototype-inheritance-part-1-of-2/
// the extends function is not already defined within the current
// context; therefore, define it
export function extendClass({ childClass, parentClass }) {
// mixin pattern for copying parent constructor function properties
// as static properties to the child constructor function
// properties on constructor function are commonly known as static
// properties
for (var parentPropertyName in parentClass) {
View - Commands.snippets
apt-get -y update && apt-get -y upgrade
# current working directory.
$(pwd)
# process status
ps aux
# show process of specific running task
ps aux | egrep '(apache|httpd)'
# restart
/sbin/reboot
View - Docker Swarm
# send request through proxy
curl -i $(docker-machine ip node-1)/demo/hello
View - Docker Dockerfile & Commands
https://github.com/wsargent/docker-cheat-sheet
https://www.docker.com/sites/default/files/Docker_CheatSheet_08.09.2016.pdf
# Install docker from script https://docs.docker.com/v1.11/linux/step_one/
curl -sSL https://get.docker.com/ | sudo bash
# Environment variables for Windows: and maybe injected into env.var
export MSYS_NO_PATHCONV=1
set COMPOSE_CONVERT_WINDOWS_PATHS=1
View Temporary list
https://www.accelebrate.com/blog/javascript-es6-classes-and-prototype-inheritance-part-1-of-2/
https://hacks.mozilla.org/2015/08/es6-in-depth-subclassing/
https://medium.com/ecmascript-2015/es6-classes-and-inheritance-607804080906
View Patterns
// Check if defined and value;
const compiledToES5 = !!(optimizeOptions.js && optimizeOptions.js.compile);
You can’t perform that action at this time.