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
<script>
export default {
props: {
span: {
type: String,
default: null
}
},
render: function (createElement) {
return createElement(
const imgOops id => {
const images = require.context('@/static/img/', true, /\.(png|jpe?g|svg)$/)
const obj = {}
images.keys().forEach(key => {
const code = key.split('./').pop()
.substring(0, key.length - 6) // remove extension
obj[code] = images(key)
})
require('dotenv').config()
const csv = require('csvtojson')
const { asyncForEach } = require('./helpers')
const { read, write } = require('./fs')
const fetch = require('node-fetch')
const { DOMAIN, USERNAME, PASSWORD } = process.env
const convert = async (source, code, type) => {
try {
@daliborgogic
daliborgogic / GitDeleteCommands.ps1
Last active January 3, 2019 10:42 — forked from cmatskas/GitDeleteCommands.ps1
Git Delete Branch commands
## Delete a remote branch
$ git push origin --delete <branch> # Git version 1.7.0 or newer
## Delete a local branch
$ git branch --delete <branch>
$ git branch -d <branch> # Shorter version
$ git branch -D <branch> # Force delete un-merged branches
## Delete a local remote-tracking branch
$ git branch --delete --remotes <remote>/<branch>
@daliborgogic
daliborgogic / wp.sh
Last active December 24, 2018 14:14
Download & Install WordPress via Curl
curl -LO https://wordpress.org/latest.zip && \
unzip latest.zip && \
rm latest.zip
@daliborgogic
daliborgogic / person.html
Last active December 23, 2018 16:27
Schema.org
<script type="application/ld+json">
{
"@context": "https:\/\/schema.org",
"@type":"Person",
"url":"https:\/\/johndoe.com\/",
"sameAs":[
"https:\/\/www.facebook.com\/johndoe\/",
"https:\/\/www.instagram.com\/johndoe\/",
"https:\/\/twitter.com\/johndoe\/"
],
@daliborgogic
daliborgogic / functions.php
Last active July 25, 2019 19:06
Headless WordpPress REST API Change post preview button url
<?php
function pwa_preview_link() {
$slug = basename(get_permalink());
$pwadomain = 'https:/example.com';
$pwadir = '/';
$pwaurl = "$pwadomain$pwadir$slug";
return "$pwaurl";
}
add_filter('preview_post_link', 'pwa_preview_link');
@daliborgogic
daliborgogic / EventEmitter.js
Last active December 17, 2018 21:51
JavaScript EventEmitter (for node.js and browsers)
class EventEmitter {
constructor() { this.events = {} }
getEventListByName(eventName){
if(typeof this.events[eventName] === 'undefined'){
this.events[eventName] = new Set()
}
return this.events[eventName]
}
@daliborgogic
daliborgogic / index.js
Last active December 9, 2022 03:40
amqp async/await node.js
const amqp = require('amqplib')
const eventEmitter = require('events')
class OopsEmitter extends eventEmitter {}
const oopsEmitter = new OopsEmitter()
;(async () => {
try {
const conn = await amqp.connect('amqp://localhost?heartbeat=5s')
const ch = await conn.createChannel()
@daliborgogic
daliborgogic / default.vue
Last active October 16, 2020 17:59
Vantablack? Nuxt.js simple theme switch
<script>
export default {
computed: {
theme () {
const [color, backgroundColor] = this.$store.state.theme
return {
'--color': color,
'--background-color': backgroundColor
}
}