Skip to content

Instantly share code, notes, and snippets.

🔥
In case of fire: git commit, git push, leave the building!

Dalibor Gogic daliborgogic

🔥
In case of fire: git commit, git push, leave the building!
Block or report user

Report or block daliborgogic

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
View regions.js
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 Jun 14, 2019
[devicemoution] Listen to motion events and update the position
View index.js
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)
View index.js
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
Abortable Fetch
View index.js
// 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 Aug 28, 2019
Split Business and Native errors Async/Await Node.js
View index.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')
View default
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;
View parsed.json
{
"default-src": [
"'none'"
],
"base-uri": [
"'self'"
],
"block-all-mixed-content": [],
"connect-src": [
"'self'",
View wp-config.php
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
View policy.md

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 Oct 7, 2019
Request a user's GitHub identity
View github.js
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 = []
You can’t perform that action at this time.