Skip to content

Instantly share code, notes, and snippets.

View ZeroDragon's full-sized avatar
🌮
Tacos de canasta

Zero Dragon ZeroDragon

🌮
Tacos de canasta
View GitHub Profile
@ZeroDragon
ZeroDragon / consoleImage.coffee
Last active April 10, 2016 05:00
image on dev tools for chrome
if console?.log?
url = "http://i.imgur.com/oGiMR.gif"
getBox = (width, height)->
return {
string: "+",
style: "font-size: 1px; padding: " + Math.floor(height/2) + "px " + Math.floor(width/2) + "px; line-height: " + height + "px;"
}
img = new Image()
img.onload = ->
dim = getBox(@.width, @.height);
@ZeroDragon
ZeroDragon / app.coffee
Last active September 28, 2016 14:32
Slack File Deleter
###*
* Confugure HERE
###
token = "Slack-Token" #Slack token
domain = "myTeamName" #Your team name
maxCool = 10 #Max retries to get files list
days = 7 #Keep this days of files
###*
* Stop editing
###
###*
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
###
@ZeroDragon
ZeroDragon / RETAGGER.md
Last active October 11, 2017 21:05
Git retagger

Rettager

This file will help you to create tags in your git repository.
Also you can use it to move a tag from commit to commit (for build tags).

Usage

Just add retagger.sh to anyplace you want (bin maybe) and add execution permissions.
Also you can just leave it in your Documents or Downloads and just add an alias in your .bashrc file

#!/bin/sh
echo "Last tag is:"
git tag | sed -e '$!d'
echo "Want to tag current commit? type the name of the tag (leave empty to skip)"
read current
if [ "$current" != "" ]; then
git tag -a $current
fi
echo "Type the name of the tag you want to move (leave blank to skip)"
@ZeroDragon
ZeroDragon / Rangemap.js
Created June 11, 2018 22:50
Range translator
class Rangemap {
constructor (input, output) {
this.inMin = input[0]
this.inMax = input[1]
this.outMin = output[0]
this.outMax = output[1]
}
transport (value, trim = false) {
let retval = (value - this.inMin) *
(this.outMax - this.outMin) / (this.inMax - this.inMin) +
@ZeroDragon
ZeroDragon / labelnator.sh
Last active July 5, 2018 19:21
Para meter las labels a los repos de RTD
#!/bin/sh
REPO=resuelve/$1
TOKEN=$2
labels=(
'{"name": "Bug 🐛", "description": "MUCHO ROJO!!!", "color": "d73a4a"}'
'{"name": "Documentación 📗", "description": "Documentación", "color": "a369ef"}'
'{"name": "Epic", "description": "Épica", "color": "3E4B9E"}'
'{"name": "Hackday 💡", "description": "Puntos extras por mejora muy opcional", "color": "5319e7"}'
@ZeroDragon
ZeroDragon / betterlogger.js
Created July 26, 2018 21:17
Replace console.log
/* globals ENV */
let environment = 'dev'
if (typeof ENV === 'undefined') environment = 'prod'
const logger = {}
const sty = color => `padding:4px;color:#fff;background-color:${color};`
const loggerTypes = {
debug: sty('green'),
info: sty('blue'),
warn: sty('orange'),
@ZeroDragon
ZeroDragon / docker-compose.yml
Created March 28, 2019 18:32
Custom loggig in docker-compose
version: '3.1'
services:
my-service:
logging:
driver: "json-file"
options:
max-size: "50m"
image: ......
@ZeroDragon
ZeroDragon / EventEmitter.js
Last active February 20, 2020 23:02
Browser side eventEmitter
class EventEmitter {
constructor () {
this.DOM = document.createElement("p")
}
on(channel, fn) {
this.DOM.addEventListener(channel, event => {
fn(event.detail)
})
}
dispatch(channel, data) {