Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Azat Mardan azat-co

🎯
Focusing
Block or report user

Report or block azat-co

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View kaiser-class-class.js
// const Animal = function() {
// this.speed = 0
// return {
// run: function() {
// this.speed += 10
// console.log(this.speed)
// }
// }
// }
View rest-crud.js
const express = require('express')
const logger = require('morgan')
let app = express()
const mongodb= require('mongodb')
const url = 'mongodb://localhost:27017/mean'
const bodyParser = require('body-parser')
app.use(bodyParser.json())
mongodb.MongoClient.connect(url, (error, db)=>{
if (error) return process.exit(1)
View timer-simple.jsx
const ReactDOM = require('react-dom')
const React = require('react')
const TimerButton = (props) => {
return (
<button type="button" onClick={()=>{
props.handler(props.time)
}}>Start {props.time}</button>
)
}
const TimerLabel = (props) => {
View hello-world-server-port.js
const port = process.env.PORT || 3000
require('http')
.createServer((req, res) => {
console.log('url:', req.url)
res.end('hello world')
})
.listen(port, (error)=>{
console.log(`server is running on ${port}`)
})
View slow-hello-world.js
const port = 80
require('http')
.createServer((req, res) => {
console.log('url:', req.url)
console.log('now we will slow down and block and consume CPU...')
for (var i=0; i< 100000000; i++) {}
res.end('hello world')
})
.listen(port, (error)=>{
console.log(`server is running on ${port}`)
@azat-co
azat-co / hello-world-server.js
Created Apr 6, 2017
Hello World Node HTTP server for AWS User Data
View hello-world-server.js
const port = 3000
require('http')
.createServer((req, res) => {
console.log('url:', req.url)
res.end('hello world')
})
.listen(port, (error)=>{
console.log(`server is running on ${port}`)
})
View bash-str.js
const assert = require('assert')
const solution = (str) => {
const checkSubs = (s, oldResults=[]) => {
let start = s.indexOf('{')
let end = s.indexOf('}', start+1)
// console.log('yo', s, start, end,s.substring(end+1, s.length))
if (start<0 && end <0) {
for (let i = 0; i<oldResults.length; i++) {
oldResults[i] += s
View node6-install.sh
sudo curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
sudo yum -y install nodejs
You can’t perform that action at this time.