Skip to content

Instantly share code, notes, and snippets.

View 4lg4's full-sized avatar

Adriano Leal (alga) 4lg4

View GitHub Profile
@4lg4
4lg4 / deputy-cafe-release.json
Last active February 25, 2021 04:32
deputy-cafe-release
{
"previous": [
{
"version": "2.2.5",
"source": "https://github.com/DeputyApp/cafe/releases/tag/V2.2.5",
"notes": "multiple DNS selection \n custom DNS list \n clear DNS button \n ability to change card DNS \n check if Pritunl is open",
"dist": {
"darwin": {
"url": "https://drive.google.com/u/1/uc?id=1iAtp8LbIOE3fsJep4hxsujRgdaRsdWOT&export=download"
}
@4lg4
4lg4 / OSX-DNS-CHANGE.md
Last active August 27, 2018 01:51
Script to change OSX DNS

Create an alias in your prefered shell

alias osx-change-dns='sudo networksetup -setdnsservers Wi-Fi $DNS && sudo networksetup -setairportpower en0 off && sudo networksetup -setairportpower en0 on'

set dns to auto

DNS=empty && deputy-change-dns

set one dns

@4lg4
4lg4 / AppAutocomplete.vue
Last active July 24, 2018 06:00
Autocomplete input with debounce
<template>
<div class="AppAutocomplete">
<input v-model="theValue" @input="change" :placeholder="placeholder" @focus="focus" @blur="focus('blur')" ref="input" autocomplete="nope" />
<div class="clear" @click="clearAll" v-if="focused">
<img src="/static/img/clear.png" />
</div>
<AppLoaderBar v-if="loading"/>
<div class="suggestions">
<ul>
<li v-for="(item, index) in theList" :key="index" @click="selected(item)">
const express = require('express');
const egraphql = require('express-graphql');
const {buildSchema} = require('graphql');
const schema = buildSchema(`
type Query {
message: String
}
`);
npm i --save babel-plugin-transform-async-to-generator babel-plugin-transform-runtime
.babelrc
{
"presets": [["env", {
"targets": {
"node": "8"
}
}]],
"plugins": ["transform-async-to-generator", "transform-runtime"]
@4lg4
4lg4 / js+tagscript+variables
Created March 28, 2018 06:30
Javascript passing variables to caller script
<script src=".." one="1" two="2"></script>
document.currentScript.getAttribute('one'); //1
document.currentScript.getAttribute('two'); //2
document.currentScript = document.currentScript || (function() {
var scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1];
})();
@4lg4
4lg4 / eslint google
Last active April 24, 2018 01:24
ESLint Google
npm install --save-dev eslint eslint-config-google
.eslintrc
{
"extends": ["google"],
"rules": {
"max-len": 0,
"require-jsdoc": 0
},
"parserOptions": {
@4lg4
4lg4 / AlgaAsyncProcess.js
Created February 26, 2018 22:47
Node.js: async process, a way to avoid huge try {} catch blocks in JS using GO approach
const asyncProcess = async (promise) => {
try {
return [null, await promise];
} catch (err){
return [err];
}
};
const [err,result] = await asyncProcess(__MyPromise__);
@4lg4
4lg4 / AlgaAerospike.js
Created February 26, 2018 22:29
Node.js: Aerospike simple wrap using promises
/**
* Created by www.Alga.me on 12/7/17.
*
* # npm install aerospike
*/
import aerospike from 'aerospike'
export default class Aerospike {
constructor(props = {}) {