Skip to content

Instantly share code, notes, and snippets.

💩
☝️

mintyPT

💩
☝️
Block or report user

Report or block mintyPT

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mintyPT
mintyPT / diff.js
Created Nov 2, 2018
Shows the difference (in keys) between 2 json files
View diff.js
// node diff.js f1.json f2.json
const _ = require('lodash');
const path = require('path');
if (process.argv.length != 4) {
throw new Error('node script.js file1.json file2.json');
}
const f1 = process.argv[2];
@mintyPT
mintyPT / toType.js
Last active Sep 13, 2018
js snippets
View toType.js
const toType = obj => ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
View gist:dfecaccc3f00a0621c5f4af71551e332

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@mintyPT
mintyPT / Bookmarklet
Last active Apr 17, 2018
Bookmarklet to search Github repos with updates in the last X days
View Bookmarklet
javascript: (function()%7Bvar t%3D%7Beval:%27"Date.prototype.yyyymmdd%3Dfunction()%7Bvar t%3Dthis.getMonth()%2B1,e%3Dthis.getDate()%3Breturn%5Bthis.getFullYear(),%5C%5C"-%5C%5C",(t>9%3F%5C%5C"%5C%5C":%5C%5C"0%5C%5C")%2Bt,%5C%5C"-%5C%5C",(e>9%3F%5C%5C"%5C%5C":%5C%5C"0%5C%5C")%2Be%5D.join(%5C%5C"%5C%5C")%7D%3Bvar search%3Dprompt(%5C%5C"Recent search on github%3F%5C%5C"),diffDays%3Dprompt(%5C%5C"Since how many days%3F%5C%5C"),today%3Dnew Date,priorDate%3D(new Date).setDate(today.getDate()-parseInt(diffDays)),d%3Dnew Date(priorDate).yyyymmdd()%3Bwindow.location%3D%5C%5C"https://github.com/search%3Futf8%3D✓%26q%3D%5C%5C"%2BencodeURIComponent(search%2B%5C%5C" pushed:>%5C%5C"%2Bd)%2B%5C%5C"%26type%3DRepositories%5C%5C"%3B"%27%7D,e%3D!0%3Bif("object"%3D%3Dtypeof this.artoo%26%26(artoo.settings.reload%7C%7C(artoo.log.verbose("artoo already exists within this page. No need to inject him again."),artoo.loadSettings(t),artoo.exec(),e%3D!1)),e)%7Bvar o%3Ddocument.getElementsByTagName("body")%5B0%5D%3Bo%7C%7C(o%3Ddocument.
@mintyPT
mintyPT / scroll.js
Created Mar 15, 2017
Animate scroll with jquery - example
View scroll.js
jQuery('.scroll-to-me').on('click', function(e) {
var $this = jQuery(this);
jQuery('html, body').animate({
scrollTop: $this.offset().top
}, 500);
})
@mintyPT
mintyPT / composition.js
Last active Jan 17, 2017
Compose functions into a new one
View composition.js
// http://scott.sauyet.com/Javascript/Talk/Compose/2013-05-22/#slide-17
var compose = function() {
var funcs = arguments;
return function() {
var args = arguments;
for (var i = funcs.length; i --> 0;) {
args = [funcs[i].apply(this, args)];
}
return args[0];
};
@mintyPT
mintyPT / index.html
Last active Feb 19, 2016
Some kind of cleaning function, no ideia why I made this though
View index.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
#input, #output {
width: 500px;
You can’t perform that action at this time.