Skip to content

Instantly share code, notes, and snippets.

View dilverdev's full-sized avatar
:octocat:
I may be slow to respond.

dilver.dev dilverdev

:octocat:
I may be slow to respond.
View GitHub Profile
@dilverdev
dilverdev / env.js
Last active August 27, 2019 19:47
Configuration env in javascript
const envConfig = {
development: {
SITE_URL: 'http://localhost:3000',
API_URL: 'http://localhost:3000/api'
},
testing: {
SITE_URL: 'https://test.site.com',
API_URL: 'https://api.test.site.com'
},
production: {
@dilverdev
dilverdev / getTitleNative.js
Created September 26, 2018 15:58 — forked from jbinto/getTitleNative.js
Get title from remote HTML URL - without jQuery
// Only using native browser features (no jQuery).
// Uses `fetch`, `DOMParser` and `querySelectorAll`.
const getTitle = (url) => {
return fetch(`https://crossorigin.me/${url}`)
.then((response) => response.text())
.then((html) => {
const doc = new DOMParser().parseFromString(html, "text/html");
const title = doc.querySelectorAll('title')[0];
return title.innerText;