Skip to content

Instantly share code, notes, and snippets.

pluscodes

Code from google/open-location-code is not usable in my environment. So I made a simple wrapper.

there is only encode and decode in index. And they are ruturning false instead of throwing error

npm install gist:5dc2ae9bca9fbcf304cc0505d7d88130

@gcoda
gcoda / htmlBuilder.js
Created July 23, 2018 13:48
vueneue-apollo
// ./node_modules/@vueneue/ssr-server/lib/htmlBuilder.js
const jsonEncode = require("fast-safe-stringify")
module.exports = async (serverContext, ssrContext, html) => {
// Metas
const bodyOpt = { body: true }
let body = html
let head = ""
let bodyAttrs = ""
# Worker DNS records
resource "digitalocean_record" "workers" {
count = "${var.worker_count}"
# DNS zone where record should be created
domain = "${var.dns_zone}"
name = "${var.cluster_name}-workers"
type = "A"
ttl = 300
# secrets in .env file
# root@drone ~/drone# cat docker-compose.yml
version: '2'
services:
drone-server:
image: drone/drone:0.8.4
ports:
- 80:80
- 443:443
Verifying my Blockstack ID is secured with the address 1CzzomvuyskMC9t65EQoGNX4gq3f3iDbj9 https://explorer.blockstack.org/address/1CzzomvuyskMC9t65EQoGNX4gq3f3iDbj9
@gcoda
gcoda / layout.vue
Created August 27, 2017 21:44
css noob here, responsive sidebar first, vue js integration second
<template lang='pug'>
- var text = "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like)."
- var list = text.split(' ').slice(1,20)
#root
input#side-toggle(ref='toggleBox' v-model='sideMenu' type='checkbox')
.head
label(:class='{"btn-primary": sideMenu}' for='side-toggle') Menu
.wrap
.side
ul.menu
@gcoda
gcoda / whiletrue.sh
Created August 22, 2017 22:23
Proper Ctrl + C on infinite bash loop
#!/usr/bin/env bash
#The exit status of a command that terminated because it received a signal shall be reported as greater than 128.
#For example if you interrupt a command with control-C the exit code will be 130, because SIGINT is signal 2 on Unix systems. So:
#source: https://unix.stackexchange.com/questions/42287/terminating-an-infinite-loop
while [ 1 ]; do
echo 1 #do the thing
sleep 1
test $? -gt 128 && break;
@gcoda
gcoda / generate.sh
Created August 3, 2017 22:56
Bash script to generate favicon and other icons for website
#!/usr/bin/env bash
# based on
# https://github.com/audreyr/favicon-cheat-sheet
# https://realfavicongenerator.net/faq
# generated text files just for refrence, big sizes based on lighthouse test
SIZES="16 24 32 48 64 120 144 150 152 180 192 256 384 512"
COLOR="FFFFFF"
MANIFEST='"icons": ['
@gcoda
gcoda / notes.md
Last active January 25, 2017 16:18
webpack, load app.js after bundle.js async

webpack config will produce something like

<script type="text/javascript" src="/dist/vendor.0fcb27d1250abb1c9f24.js" async></script>
<script type="text/javascript" src="/dist/app.0fcb27d1250abb1c9f24.js" defer></script>

and while serving index.html i am replacing it with:

<script type="text/javascript" src="/dist/vendor.0fcb27d1250abb1c9f24.js" async></script>
<script type="text/javascript" async>
 var load = function() {
#!/usr/bin/sh
# i am not very good with bash, but looks like its working fine
########################################################
#
# evtest /dev/input/event14 | ./4click.sh 'notify-send tap4' | sh
#
########################################################
cancelTap=true