Skip to content

Instantly share code, notes, and snippets.

View martinec's full-sized avatar
🚀
Turning data into Knowledge

Cristian Martinez martinec

🚀
Turning data into Knowledge
View GitHub Profile
@smeijer
smeijer / parse-es6-template.js
Last active October 26, 2024 03:15
ES6 template string parser
function get(path, obj, fb = `$\{${path}}`) {
return path.split('.').reduce((res, key) => res[key] || fb, obj);
}
function parseTpl(template, map, fallback) {
return template.replace(/\$\{.+?}/g, (match) => {
const path = match.substr(2, match.length - 3).trim();
return get(path, map, fallback);
});
}
@stephenway
stephenway / git-change-author-commit.sh
Created December 19, 2015 04:02
Change last commit author
git commit --amend --author "Stephen Way <[email protected]>" --no-edit && \
git rebase --continue
...
git push origin master --force
@MoOx
MoOx / index.js
Last active November 14, 2024 22:42
Export/import github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
@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:
@mildmojo
mildmojo / rotate_desktop.sh
Created June 18, 2014 06:47
Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops.
#!/bin/bash
#
# rotate_desktop.sh
#
# Rotates modern Linux desktop screen and input devices to match. Handy for
# convertible notebooks. Call this script from panel launchers, keyboard
# shortcuts, or touch gesture bindings (xSwipe, touchegg, etc.).
#
# Using transformation matrix bits taken from:
# https://wiki.ubuntu.com/X/InputCoordinateTransformation
@chrismccoy
chrismccoy / gitcheats.txt
Last active October 16, 2024 15:36
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# sort list of git repos with gh cli
gh repo list --limit 300 --json name -q '.[].name' | sort
# count total commits in a repo
git rev-list --all --count
@jancborchardt
jancborchardt / Dealing with issues.md
Last active January 24, 2022 23:07
Dealing with issues

Dealing with issues

Try to reproduce issues

Go through the new issues and try to reproduce them. It’s important to get additional info, logs, and test if an issue occurs on different platforms. That helps us identify the source of the problem.

Triage issues

  • if there’s more info needed, ask the reporter to use the issue template
  • assign relevant labels
@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@Gozala
Gozala / hidden-window.js
Created December 20, 2012 17:56
Create an addon's own hidden window.
let Cc = Components.classes;
let Ci = Components.interfaces;
let appShellService = Cc['@mozilla.org/appshell/appShellService;1'].
getService(Ci.nsIAppShellService);
let ioService = Cc['@mozilla.org/network/io-service;1'].
getService(Ci.nsIIOService);
let uri = "data:application/xhtml+xml;charset=utf-8,<html/>"
let xulWindow = appShellService.createTopLevelWindow(
@abeluck
abeluck / gpg-offline-master.md
Last active October 22, 2023 02:59 — forked from KenMacD/cmd.md
GPG Offline Master Key w/ smartcard