Skip to content

Instantly share code, notes, and snippets.

@mjlescano
mjlescano / Readme.md
Last active December 15, 2023 06:52
Bash command to copy permissions from a file to other(s).
@mjlescano
mjlescano / form-reset-helpers.scss
Last active November 30, 2022 16:08 — forked from anthonyshort/Super Form Reset.css
Reset for form elements written in SCSS
/* ----------------------------------------------------------------------------------------------------
SCSS Form Reset Helpers - Forked from: https://gist.github.com/anthonyshort/552543
Intended usage:
- MIXINS: for very specific use cases, when you dont want to reset absolutly all the forms, very verbose output.
- PLACEHOLDER SELECTORS: use as extending classes. Less verbose, more generic overrides.
A couple of things to watch out for:
@mjlescano
mjlescano / git-minimal-aliases.sh
Last active November 13, 2019 18:59
Git Minimal aliases. e.g "push" to push current branch
alias status="_exec git status"
alias s="git status --short"
alias fetch="_exec git fetch"
alias stash="_exec git stash"
alias commit="_exec git commit"
alias checkout="_exec git checkout"
alias add="_exec git add"
alias diff="_exec git diff"
alias co="checkout"
@mjlescano
mjlescano / publish-if-needed
Last active September 17, 2018 17:28
Shell command to publish an npm package only if its needed
#!/bin/bash
CURRENT_VERSION=$(npm show $(node -pe 'require("./package.json").name') version)
NEXT_VERSION=$(node -pe 'require("./package.json").version')
[ "$CURRENT_VERSION" != "$NEXT_VERSION" ] && npm publish
@mjlescano
mjlescano / index.js
Created October 26, 2017 17:04
Auto-merge GitHub PR when all checks passed
(() => {
const check = () => {
const status = document.querySelector('[data-combined-status]').dataset.combinedStatus
switch(status) {
case 'success':
const btn = document.querySelector('[data-details-container=".js-merge-pr"]')
if (!btn) {
alert('PR already merged.')
break
@mjlescano
mjlescano / .gitignore
Last active June 21, 2017 17:06
Filstack PDF Preview - PoC
dist
node_modules
@mjlescano
mjlescano / import.js
Created February 1, 2017 18:43
Imports Topics to DemcoracyOS from a JSON file
const fs = require('fs')
const mongoose = require('mongoose')
const Batch = require('batch')
const models = require('lib/models')
const data = require('./topics.json')
const ObjectId = mongoose.Schema.ObjectId
models()
@mjlescano
mjlescano / tocsv.js
Created October 17, 2016 11:49
Topics with Author CSV export example - DemocracyOS | Runs with `NODE_PATH=. node tocsv.js`
var fs = require('fs')
var json2csv = require('json2csv')
var models = require('lib/models')
models()
var Topic = models.Topic
Topic
.find({deletedAt: null})
@mjlescano
mjlescano / script.js
Last active September 26, 2016 18:17
Mass-edit emails of users on DemocracyOS on mongoose
var OWNER_EMAIL = process.env.OWNER_EMAIL || 'debug-email@gmail.com'
//--------------------------
require('lib/models')()
var config = require('lib/config')
var models = require('lib/models')
var User = models.User
@mjlescano
mjlescano / log.sh
Created March 26, 2016 21:49
Minimal helper functions for logging on Bash
#! /bin/bash
info () {
echo "$(tput setaf 6) · $@$(tput sgr0)"
}
warn () {
echo "$(tput setaf 3) · $@$(tput sgr0)"
}