Skip to content

Instantly share code, notes, and snippets.

View daliborgogic's full-sized avatar
:octocat:
In Git we trust!

Dalibor Gogic daliborgogic

:octocat:
In Git we trust!
View GitHub Profile
export default [
['Region Hovedstaden', [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]],
['Region Sjælland', [40,41,42,43,44,45,46,47,48,49]],
['Region Syddanmark', [50,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,70,71,72,73]],
['Region Midtjylland', [74,75,76,78,80,82,,83,84,85,86,88,89]],
['Region Nordjylland', [77,79,90,92,93,94,95,96,97,98,99]],
['Grønland', [39]]
]
@daliborgogic
daliborgogic / index.js
Last active June 14, 2019 19:42
[devicemoution] Listen to motion events and update the position
export default {
mounted () {
if (window.DeviceMotionEvent) {
// Listen to motion events and update the position
window.addEventListener('devicemotion', this.devicemotion, false)
}
},
destroyed () {
window.removeEventListener('devicemotion', this.devicemotion)
const query = {
bool: {
should: [
{
query_string: {
query: value,
type: 'cross_fields',
minimum_should_match: '100%',
analyze_wildcard: true,
fields: [
@daliborgogic
daliborgogic / index.js
Created May 20, 2019 15:18
Abortable Fetch
// This will allow us to abort the fetch
let controller
// Abort if the user clicks
abortBtn.addEventListener('click', () =>
if (controller) controller.abort()
)
// Load the content
loadBtn.addEventListener('click', async () => {
@daliborgogic
daliborgogic / index.js
Last active August 28, 2019 16:02
Split Business and Native errors Async/Await Node.js
const { parse } = require('url')
const fetch = require('node-fetch')
/*
Native Error types
@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
*/
const nativeExceptions = [
EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError
].filter(except => typeof except === 'function')
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl http2 default_server;
{
"default-src": [
"'none'"
],
"base-uri": [
"'self'"
],
"block-all-mixed-content": [],
"connect-src": [
"'self'",
@daliborgogic
daliborgogic / wp-config.php
Last active May 12, 2019 18:16
[SMTP WP] #wp
define('SMTP_USER','mail@example.com'); // Username to use for SMTP authentication
define('SMTP_PASS', '############'); // Password to use for SMTP authentication
define('SMTP_HOST', 'mail.host.com'); // The hostname of the mail server
define('SMTP_FROM', 'mail@example.com'); // SMTP From email address
define('SMTP_NAME', 'Example'); // SMTP From name
define('SMTP_PORT', '587'); // SMTP port number - likely to be 25, 465 or 587
define('SMTP_SECURE', 'tls'); // Encryption system to use - ssl or tls
define('SMTP_AUTH', true); // Use SMTP authentication (true|false)
define('SMTP_DEBUG', 0); // for debugging purposes only set to 1 or 2

Valid host expressions can include:

  • https://*.devoops.app Matches all subdomains of devoops.app using the HTTPS scheme but not devoops.app itself.

  • www.devoops.app443 Matches www.devoops.app only on port 443 using any scheme.

  • https://devoops.app:* Matches any port on devoops.app using HTTPS.

Name Options Description
@daliborgogic
daliborgogic / github.js
Last active October 7, 2019 17:44
Request a user's GitHub identity
const uuid = require('uuid')
const {
GITHUB_CLIENT_ID = '#####',
GITHUB_REDIRECT_URL = 'https://example.com/callback',
GITHUB_SCOPE = 'user:email'
} = process.env
const authorize = `https://github.com/login/oauth/authorize`
const states = []