Skip to content

Instantly share code, notes, and snippets.

View jayjariwala's full-sized avatar
👾
Debugging

Jay Jariwala jayjariwala

👾
Debugging
View GitHub Profile
// docker version
docker --version
// Pull image from docker hub
docker pull wasfeng/whalesy
// Run the pulled image or images already on the local system - Run the container from the image
docker run wasfeng/whalesy
// Stop the running docker container
docker stop NAME(name of the container - assigned by the docker cli)
// List all the running container
docker ps
function createCircle(r) {
let radius = r;
this.draw = function() {
console.log("draw the cirlce");
};
this.getRadius = function() {
return radius;
};
this.setRadius = function(val) {
// Object literals
const obj = {
radius: 1,
location: {
x : 1,
y : 2
},
draw:function () {
console.log('draw');
}
@jayjariwala
jayjariwala / gist:8933371f5dab4aa9395d1e9b4b871e33
Last active February 16, 2018 20:08
Webpack config essential plugins and loaders
//plugins
html-webpack-plugin -load javascript file dynamically
clean-webpack-plugin -clean distribution folder.
//css loaders
style-loader
css-loader
# Temporary outage method
sudo certbot --authenticator standalone --installer nginx \
-d <domain> --pre-hook "service nginx stop" --post-hook "service nginx start"
@jayjariwala
jayjariwala / Objects.md
Last active January 19, 2018 21:02
YDKJS - Objects

Objects

Syntax

Object come in two forms

  1. the declarative form (litral)
  2. Constrcted form

Declarative/litral Object

This is not an author-time binding but a runtime binding.
this has nothing to do with where a function is declared, but has everthing to do with the manner in which the function is called.
when a function is invoked, an activation record, otherwise known as an exection context, is created.
it contains information about where the function was called from (the call-stack), how the function was invoked, what parameters where passed. etc.
one of the properties of this record is this reference, which will be used for the duration of that function's execution.
To understand the this binding, we have to understand the call-site.
call site and call stack
@jayjariwala
jayjariwala / gist:f2555d900cd81150e215c2684481fa53
Last active January 17, 2018 02:02
YDK JS - Scope and Closure
Program state: the ability of a language to store value in a variable and later retrive or modify those values. In fact,
the ability store values and pull values out of variables is what gives a program state.
where do those variables live?
where are they store?
how does our program find them?
The set of rules for storing varibales in some location, and for finding those variables at a later time is called scope.
In traditional compiled-language, a chunk of source code, your program , will undergo typically three steps before it is executed, roughly called "compilcation".
You can think of clousre as a way of "remember" and continue to access a function's scope even once the function has finished running.
function makeAddr(x)
{
//paraneter 'x' is an inner variable
//inner function add() uses 'x', so it has clousre over it
function add(y)
{
return x + y;
@jayjariwala
jayjariwala / Pomodoro-Clock .txt
Last active January 11, 2018 18:56
Pomodoro Clock
// desgin inspiration https://dribbble.com/shots/2324994-Daily-UI-Day-14-Countdown-Timer/attachments/442297
(function(){
let focusSecs;
let breakSecs;
let timer;
let isPaused = false;
let pausedSecs = 0;