Skip to content

Instantly share code, notes, and snippets.

🎯
Running away

Ali Hesari alihesari

🎯
Running away
Block or report user

Report or block alihesari

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
@alihesari
alihesari / user.js
Created Jan 1, 2019 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
View user.js
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@alihesari
alihesari / countries.json
Last active Sep 18, 2018
JSON List of countries of the world
View countries.json
[
{
"name": "Afghanistan",
"shortName": "AF",
"capital": "Kabul",
"continent": "Asia"
},
{
"name": "Aland Islands",
"shortName": "AX",
@alihesari
alihesari / letsencrypt_2018.md
Created Sep 2, 2018 — forked from cecilemuller/letsencrypt_2019.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2018.md

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@alihesari
alihesari / app.js
Created Aug 31, 2018 — forked from stongo/app.js
Joi validation in a Mongoose model
View app.js
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;
db.on('error', function() {
return console.error.bind(console, 'connection error: ');
});
@alihesari
alihesari / README.md
Created May 13, 2018 — forked from joyrexus/README.md
Form/file uploads with hapi.js
View README.md

Demo of multipart form/file uploading with hapi.js.

Usage

npm install
npm run setup
npm run server

Then ...

View webpack.config.js
var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: './src/js/main.js',
output: {
path: path.resolve(__dirname, 'dist/'),
publicPath: 'dist/',
filename: 'bundle.js'
@alihesari
alihesari / webpack.config.js
Last active Jan 18, 2018
This web pack config convert assets file (images and fonts) to base64
View webpack.config.js
var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: './src/js/main.js',
output: {
path: path.resolve(__dirname, 'dist/'),
publicPath: 'dist/',
filename: 'bundle.js'
You can’t perform that action at this time.