Skip to content

Instantly share code, notes, and snippets.

View azat-co's full-sized avatar
🎯
Focusing

Professor Azat Mardan azat-co

🎯
Focusing
View GitHub Profile
@azat-co
azat-co / hello-world-server.js
Created April 6, 2017 16:59
Hello World Node HTTP server for AWS User Data
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}`)
})
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}`)
})
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) => {
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)
@azat-co
azat-co / file-structure
Created June 6, 2013 23:24
Instagram Gallery: A demo app build with Storify API and Node.js http://storify.com/storifydev/instagram-gallery/
- index.js
- package.json
- public/js/main.js
- public/index.html
- css/bootstrap-responsive.min.css
- css/flatly-bootstrap.min.css
@azat-co
azat-co / test
Created November 27, 2017 01:14
alert('test');
@azat-co
azat-co / express.js
Last active August 19, 2018 03:30
Tutorial: REST API with Node.js and MongoDB using Mongoskin and Express.js
var express = require('express')
, mongoskin = require('mongoskin')
var app = express()
app.use(express.bodyParser())
var db = mongoskin.db('localhost:27017/test', {safe:true});
app.param('collectionName', function(req, res, next, collectionName){
req.collection = db.collection(collectionName)
// const Animal = function() {
// this.speed = 0
// return {
// run: function() {
// this.speed += 10
// console.log(this.speed)
// }
// }
// }
@azat-co
azat-co / JSFUN.md
Last active February 7, 2020 12:22
JavaScript FUNdamentals

JS FUNdamentals

If it's not fun, it's not JavaScript.

Expressiveness

Programming languages like BASIC, Python, C has boring machine-like nature which requires developers to write extra code that's not directly related to the solution itself. Think about line numbers in BASIC or interfaces, classes and patterns in Java.

On the other hand JavaScript inherits the best traits of pure mathematics, LISP, C# which lead to a great deal of expressiveness (and fun!).