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
| var http = require('http'); //add the http module | |
| //Create a server | |
| var myServer = http.createServer(function (request, response) { | |
| // Return something from server | |
| response.writeHead(200, {"Content-Type": "text/plain"}); | |
| response.end("Hello Node\n"); | |
| }); //create a server | |
| Bind server to a port |
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
| Delete all containers: docker rm $(docker ps -a -q) | |
| Delete all images: docker rmi $(docker image ls -q) |
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
| var possibleCombinationSum = function(arr, n) { | |
| if (arr.indexOf(n) >= 0) { return true; } | |
| if (arr[0] > n) { return false; } | |
| if (arr[arr.length - 1] > n) { | |
| arr.pop(); | |
| return possibleCombinationSum(arr, n); | |
| } | |
| var listSize = arr.length, combinationsCount = (1 << listSize) | |
| for (var i = 1; i < combinationsCount ; i++ ) { | |
| var combinationSum = 0; |
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 | |
| if [ -z "$1" ]; then | |
| echo "Usage: sudo $0 /dev/sdh1" | |
| exit 1; | |
| fi | |
| dd if=$1 of=/dev/null & pid=$! | |
| while true; do | |
| ps -p$pid --no-heading || break; | |
| echo "-- $(date) ------------------"; |
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
| ES5/6 : | |
| //ES6 | |
| const numbers= [1,2,3,4,5]; | |
| const add = (a,b) => a+b; | |
| const sub = (a,b) => a-b; | |
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
| import React, { useRef, useState, FunctionComponent, useEffect } from 'react' | |
| import MUIRichTextEditor from 'mui-rte' | |
| import Grid from '@material-ui/core/Grid' | |
| import { createMuiTheme, makeStyles, MuiThemeProvider } from '@material-ui/core/styles' | |
| import Popover from '@material-ui/core/Popover' | |
| import TextField from '@material-ui/core/TextField' | |
| import IconButton from '@material-ui/core/IconButton' | |
| import Button from '@material-ui/core/Button' | |
| import BackupIcon from '@material-ui/icons/Backup' | |
| import DoneIcon from '@material-ui/icons/Done' |