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
@daliborgogic
daliborgogic / cart.vue
Last active September 22, 2018 19:07
<template lang="pug">
svg(viewBox="0 0 119 20" version="1.1" xmlns="http://www.w3.org/2000/svg")
rect(v-for="p, index in om" width="1" :height="p === 0 ? 1 : p" :key="index" :x="index * 2" :y="p === 0 ? 19 : 20 - p" fill="#999")
</template>
<script>
export default {
data () {
return {
@daliborgogic
daliborgogic / workers.js
Last active September 18, 2018 15:52
Web Workers Example
const marked = require('marked')
self.onmessage = function (event) {
switch (event.data) {
case 'next':
next(event.data)
break
case 'license':
license(event.data)
break
@daliborgogic
daliborgogic / Dockerfile
Last active September 15, 2018 17:35
DevOops Multi Stage Build
FROM mhart/alpine-node:10.10.0 as full
WORKDIR /app
ENV HOST 0.0.0.0
COPY . .
RUN npm ci
RUN npm run build
RUN rm -rf node_modules
# Magic!
RUN npm ci nuxt-start-edge debug --production
@daliborgogic
daliborgogic / .dockerignore
Last active December 22, 2019 08:16
Mnml Nuxt.js Docker ~57.5MB
*
!assets
!pages
!static
!nuxt.config.js
!package*.json
@babel
@csstools
@nuxtjs
@vue
@webassemblyjs
@xtuc
accepts
acorn
acorn-dynamic-import
ajv
@daliborgogic
daliborgogic / Content.vue
Last active November 6, 2019 12:35
Mark external links (UX). internal let router handle.
<template>
<div v-html="content" />
</template>
<script>
export default {
props: {
content: {
type: String,
default: ''
@daliborgogic
daliborgogic / H1.vue
Last active September 11, 2018 11:37
<template lang="pug">
h1(v-html="content")
</template>
<script>
export default {
props: {
content: {
type: String,
default: ''
function notify_post ($post_id) {
$request = new WP_REST_Request('GET', '/wp/v2/posts/' . $post_id);
$response = rest_do_request($request);
$status = $response->get_status();
$data = $response->get_data();
$callback_uri = 'https://example.com';
wp_safe_remote_post($callback_uri, array('body' => json_encode($data)));
}
add_action('post_updated', 'notify_post');
@daliborgogic
daliborgogic / gist:ae3e8a5cf6a50d7ab096d5ad3f901829
Last active September 3, 2018 14:00
Set environment variables from file
$ cat > .env << EOL
foo=foo
foobar="foo bar"
EOL

$ env grep -v '^#' .env | xargs -d '\n' -t
echo  foo=foo foobar="foo bar" 
env: ‘bar"’: No such file or directory