Skip to content

Instantly share code, notes, and snippets.

View avrebarra's full-sized avatar
👨‍🚀
Experimenting on things

Avre Barra avrebarra

👨‍🚀
Experimenting on things
View GitHub Profile
@avrebarra
avrebarra / values_pointers.go
Created September 30, 2019 05:27 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@avrebarra
avrebarra / find-cli-arguments.js
Created September 26, 2019 04:21
Helper function to search for an argument passed to NodeJS app. Search by argument's name.
// helper method to search for an argument passed to node app
// rules: arguments must be preceded with '--' characters to be recognized as parameter
// example: node apps.js --port=2134 host=2312 --force ('host' won't be recognized, 'force'
// will be recognized and returns 'true')
const _findargs = (name) => {
const args = process.argv.slice(2); const param = args.find((el) => el.startsWith(`--${name}`))
if (!param) return null
if (param.indexOf('=') === -1) return 'true'
return param.replace(`--${name}=`, '')
@avrebarra
avrebarra / interpolate-string.js
Last active October 18, 2019 07:35
Interpolate params into string base in JavaScript
// i9e (interpolate) parameters into string
export const i9eStr = (baseStr = '', params = {}) => {
const interpolatables = /\{(\w+?)\}/g;
let i9edStr = baseStr;
(baseStr.match(interpolatables) || []).forEach((hit) => {
const hitKey = hit.substring(1, hit.length - 1);
i9edStr = i9edStr.replace(hit, params[hitKey] || '');
});
@avrebarra
avrebarra / README-Template.md
Created January 17, 2018 02:01 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites