Skip to content

Instantly share code, notes, and snippets.

View pedromcunha's full-sized avatar
🤘
Hello! Olá!

Pedro Cunha pedromcunha

🤘
Hello! Olá!
View GitHub Profile
[
{
"name": "Agile"
},
{
"name": "Playful"
},
{
"name": "Fierce"
},
/*! iFrame Resizer (iframeSizer.min.js ) - v4.3.9 - 2023-11-10
* Desc: Force cross domain iframes to size to content.
* Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame.
* Copyright: (c) 2023 David J. Bradshaw - [email protected]
* License: MIT
*/
!function(d){var c,u,a,v,x,I,M,r,f,k,i,l,z;function m(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function F(e,n,i){e.addEventListener(n,i,!1)}function B(e,n,i){e.removeEventListener(n,i,!1)}function p(e){return x+"["+(n="Host page: "+(e=e),n=window.top!==window.self?window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e:n)+"]";var n}function t(e){return k[e]?k[e].log:u}function O(e,n){o("log",e,n,t(e))}function E(e,n){o("info",e,n,t(e))}function R(e,n){o("warn",e,n,!0)}function o(e,n,i,t){!0===t&&"object"==typeof window.console&&console[e](p(n),i)}function w(e){function i(){t("Height"),t("Width"),P(function(){H(w),C(b),l("onResiz
[
{
"objectId": "IMLPUuefAK",
"name": "Aardvark",
"createdAt": "2020-05-28T14:44:03.204Z",
"updatedAt": "2020-05-28T14:44:03.204Z"
},
{
"objectId": "GJ2EPS2RRe",
"name": "Abyssinian",
@pedromcunha
pedromcunha / aoc-4-1.js
Created December 27, 2019 19:08
Adent of Code 4.1
// const range = 136760-595730
const minimum = 136760
const maximum = 595730
let possiblePasswords = 0
class PasswordChecker {
check(password) {
password = password.split("")
const hasJointDuplicates = this.hasJointDuplicates(password)
@pedromcunha
pedromcunha / aoc-3-2.js
Created December 27, 2019 18:15
AOC Part 3.2
class Plotter {
constructor() {
this.plots = {
wire1: {},
wire2: {},
intersects: {}
}
this.currentSteps = 0
}
@pedromcunha
pedromcunha / aoc-3-1.js
Last active December 27, 2019 18:16
Advent of code Day 3.1
const wire1 = "R993,U847,R868,D286,L665,D860,R823,U934,L341,U49,R762,D480,R899,D23,L273,D892,R43,U740,L940,U502,L361,U283,L852,D630,R384,D758,R655,D358,L751,U970,R72,D245,L188,D34,R355,U373,L786,U188,L304,D621,L956,D839,R607,U279,L459,U340,R412,D901,L929,U256,R495,D462,R369,D138,R926,D551,L343,U237,L434,U952,R421,U263,L663,D694,R687,D522,L47,U8,L399,D930,R928,U73,L581,U452,R80,U610,L998,D797,R584,U772,L521,U292,L959,U356,L940,D894,R774,U957,L813,D650,L891,U309,L254,D271,R791,D484,L399,U106,R463,D39,L210,D154,L380,U86,L136,D228,L284,D267,R195,D727,R739,D393,R395,U703,L385,U483,R433,U222,L945,D104,L605,D814,L656,U860,L474,D672,L812,U789,L29,D256,R857,U436,R927,U99,R171,D727,L244,D910,L347,U789,R49,U598,L218,D834,L574,U647,L185,U986,L273,D363,R848,U531,R837,U433,L795,U923,L182,D915,R367,D347,R867,U789,L776,U568,R969,U923,L765,D589,R772,U715,R38,D968,L845,D327,R721,D928,R267,U94,R763,U799,L946,U130,L649,U521,L569,D139,R584,D27,L823,D918,L450,D390,R149,U237,L696,U258,L757,U810,L216,U202,L966,U157,R702,D623,R740,D5
const program = [1,12,2,3,1,1,2,3,1,3,4,3,1,5,0,3,2,10,1,19,1,19,5,23,1,23,9,27,2,27,6,31,1,31,6,35,2,35,9,39,1,6,39,43,2,10,43,47,1,47,9,51,1,51,6,55,1,55,6,59,2,59,10,63,1,6,63,67,2,6,67,71,1,71,5,75,2,13,75,79,1,10,79,83,1,5,83,87,2,87,10,91,1,5,91,95,2,95,6,99,1,99,6,103,2,103,6,107,2,107,9,111,1,111,5,115,1,115,6,119,2,6,119,123,1,5,123,127,1,127,13,131,1,2,131,135,1,135,10,0,99,2,14,0,0]
function getOpCodeValues(program, i) {
const valuePos1 = program[i + 1]
const valuePos2 = program[i + 2]
const outputPos = program[i + 3]
return [program[valuePos1], program[valuePos2], outputPos]
}
for (var i = 0; i < program.length; i += 4) {
@pedromcunha
pedromcunha / aoc-1.js
Last active December 6, 2019 18:39
Advent of Code Day 1
let modules = ["109506", "140405", "139135", "110950", "84296", "123991", "59438", "85647", "81214", "100517", "100910", "57704", "83368", "50777", "85523", "95788", "127699", "138908", "95502", "81703", "67317", "108468", "58394", "72202", "121580", "86908", "72705", "86578", "83714", "114900", "142915", "51332", "69054", "97039", "143539", "61143", "113534", "98335", "58533", "83893", "127138", "50844", "88397", "133591", "83563", "52435", "96342", "109491", "81148", "127397", "86200", "92418", "144842", "120142", "97531", "54449", "91004", "129115", "142487", "68513", "140405", "80111", "139359", "57486", "116973", "135102", "59737", "144040", "95483", "134470", "60473", "113142", "78189", "53845", "124139", "78055", "63791", "99879", "58630", "111233", "80544", "76932", "79644", "116247", "54646", "85217", "110795", "142095", "74492", "93318", "122300", "82755", "147407", "98697", "98105", "132055", "67856", "109731", "75747", "135700"]
let total = modules.map((module) => {
let totalFuelCost = 0
let c
git branch --merged >/tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done