Skip to content

Instantly share code, notes, and snippets.

View kerminz's full-sized avatar

Kermin Zahirovic kerminz

View GitHub Profile
@kerminz
kerminz / nodejs-helloWorld-webServer.js
Created May 12, 2019 11:54
Simple Web-Server with NodeJS & Express
const express = require('express')
const app = express()
app.get('/', (req, res) => {
res.send('Hello World')
})
app.listen(3000, (err) => {
if (err) {
console.log("Error: ", err)
@kerminz
kerminz / rest-api-nodejs-express.js
Created May 13, 2019 12:26
Basic REST API with NodeJS and Express
const request = require('request')
const express = require('express')
const app = express()
app.get('/', (req, res) => {
if (!req.query.search) {
return res.send('Please provide a search string...')
@kerminz
kerminz / fetch-data-clientside-promise.js
Created May 13, 2019 19:43
Fetch data clientside with promises
const url = 'http://api.fetchurl.com'
fetch(url).then((response) => {
response.json().then((data) => {
console.log(data)
})
})
// expected output: JSON Object
@kerminz
kerminz / basic-mongoDB-nodejs-connection.js
Last active May 19, 2019 11:21
Basic MongoDB Connection with NodeJS
const mongodb = require('mongodb')
const MongoClient = mongodb.MongoClient
const connectionURL = 'mongodb://127.0.0.1:27017'
const databaseName = 'customDatabaseName'
MongoClient.connect(connectionURL, { useNewUrlParser: true }, (error, client) => {
if (error) {
return console.log('Unable to connect to database!')
}
@kerminz
kerminz / crud-mongodb-nodejs.js
Created May 19, 2019 17:35
CRUD – MongoDB + NodeJS
// CRUD create read update delete
const { MongoClient, ObjectID } = require('mongodb')
const connectionURL = 'mongodb://127.0.0.1:27017'
const databaseName = 'databaseName'
MongoClient.connect(connectionURL, { useNewUrlParser: true }, (error, client) => {
if (error) {
window.location.href.split(/[?#]/)[0] + '/'
@kerminz
kerminz / abr-modal.js
Last active February 3, 2020 19:10
AB Rocket Onboarding Example Experiment
var banner_bottom = '<div class="banner-bottom">'+
' <div class="banner-bottom-content">'+
' <span>Lorem Ipsum Dolor!</span>'+
' <a class="c-btn" target="_blank" href="https://www.google.com" title="Click me">CLICK ME!</a>'+
' </div>'+
' <div class="banner-close">'+
' x'+
' </div>'+
'</div>';
@kerminz
kerminz / abr-modal.css
Last active February 3, 2020 19:11
AB Rocket Onboarding Modal Style
.banner-bottom {
position: fixed;
left: 0px;
top: 0px;
height: 55px;
width: 100%;
color: #fff;
background: #001429;
z-index: 1333333337!important;
}