$ docker
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 readline = require('readline'); | |
var waitTime = 3000; | |
var currentTime = 0; | |
var waitInterval = 500; | |
var percentageWaited = 0; | |
function writeWaitingPercentage(p){ | |
readline.clearLine(process.stdout); | |
readline.cursorTo(process.stdout, 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
const readline = require('readline'); | |
const rl = readline.createInterface(process.stdin, process.stdout); | |
const realPerson = { | |
name: "", | |
sayings: [] | |
}; | |
rl.question("Who is real person? ", function(answer){ | |
realPerson.name = answer; | |
rl.setPrompt(`What would ${realPerson.name} say? `); |
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
// Basic events functionality | |
// const EventEmitter = require('events'); | |
// const emitter = new EventEmitter(); | |
// emitter.on('messageLogged', function(args){ | |
// console.log(`${args.name} : ${args.age}`) | |
// console.log("Listener called"); | |
// }); |
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
const exec = require('child_process').exec; | |
exec("open https://facebook.com"); | |
exec('ls', function(err, stdout){ | |
if(err) | |
console.log(err) | |
console.log("Listing finished..") | |
console.log(stdout); |
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
console.log('Before'); | |
getUser(1, displayUser); | |
console.log("After"); | |
function getUser(id, callback){ | |
setTimeout(() => { | |
console.log("Reading a user from database!"); | |
callback({ id: id, name: "salmanx" }) |
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
const p = new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve(1); | |
// reject(new Error('message')); | |
}, 2000) | |
}); |
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
console.log('Before'); | |
// callback approach | |
// getUser(1, displayUser); | |
// promised based approach | |
// getUser(1) | |
// .then(user => getRepositories(user.name)) | |
// .then(repos => getCommits(repos[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
import { createStore, combineReducers} from "redux"; | |
import uuid from 'uuid/v1'; | |
// NOTE: | |
// to create store we need to pass reducer in createStore() method | |
// reducer is a function with state and action params - testReducer(state = demostate, action) | |
// reducer will return result based on action.type | |
// we need to pass demoState in params | |
// state of the application would look like this demoState |
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
# Ruby wrapper for UglifyJS JavaScript compressor | |
gem "uglifier", ">= 1.3.0" | |
#Search Engine Optimization (SEO) | |
gem "meta-tags" | |
# Sucker Punch is a Ruby asynchronous processing library using concurrent-ruby, heavily influenced by Sidekiq and girl_friday. | |
gem "sucker_punch" |