Skip to content

Instantly share code, notes, and snippets.

View l-portet's full-sized avatar
🤙

Lucas Portet l-portet

🤙
View GitHub Profile
@l-portet
l-portet / bypass-shopify-store-password.html
Created May 15, 2023 15:42
Automatically bypass a Shopify store public password page
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Redirecting...</title>
</head>
<body>
<form
method="post"
@l-portet
l-portet / fly-deploy-last-commit.sh
Last active August 28, 2023 08:59
fly deploy last commit instead of all files
#!/usr/bin/env bash
last_commit=$(git log --format="%h %s" -n 1)
echo "this will deploy your last local commit"
echo $last_commit
while true; do
read -p "Do you want to continue? (y/n) " yn
case $yn in
@l-portet
l-portet / dump-collection.mjs
Created March 27, 2023 10:04
Dump a mongo collection
import 'dotenv/config';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { MongoClient } from 'mongodb';
const DB_NAME = '';
const COLLECTION_NAME = '';
@l-portet
l-portet / find-all-props.js
Created August 26, 2022 07:22
Find all properties & methods of an object, up to the root prototype
// Find all properties & methods of an object, up to the root prototype
function findAllProps(obj, props = []) {
if (!obj) {
return props;
}
return findAllProps(Object.getPrototypeOf(obj), [
...props,
Object.getOwnPropertyNames(obj),
]);
}
@l-portet
l-portet / cursor-emoji.scss
Last active August 6, 2022 22:38
SCSS mixin to use an emoji as a cursor
@mixin cursor-emoji($emoji) {
cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewport='0 0 100 100' style='fill:black;font-size:24px;'><text y='50%'>"+$emoji+'</text></svg>')
16 0,
auto;
}
@l-portet
l-portet / foobar-challenge.js
Created July 31, 2022 21:19
Check if there's any Google foobar challenge invite in the page comments
// Check if there's any Google foobar challenge invite in the page comments
// https://www.geeksforgeeks.org/google-foo-bar-challenge/
(() => {
function getAllComments() {
const $root = document.documentElement;
const comments = [];
const iterator = document.createNodeIterator($root, NodeFilter.SHOW_COMMENT, () => NodeFilter.FILTER_ACCEPT, false);
let node;
while (node = iterator.nextNode()) {
@l-portet
l-portet / airbnb-price-per-person.js
Created December 24, 2021 17:22
Show the total price per person of an Airbnb listing
// Script that shows the total price of an Airbnb listing divided by the number of persons
// Inject it in any Airbnb search page (https://airbnb.com/s/*)
!function() {
function runner() {
const persons = +new URL(window.location.href).searchParams.get('adults');
if (!persons) {
return;
}
@l-portet
l-portet / vuex-global-mutation.js
Last active August 26, 2022 07:24
Edit all nested props of a Vuex state with a single mutation
// Usage:
// commit ('SET', { prop: `path.to['my'].prop[1]`, value: 42 });
// or commit ('SET', [`path.to['my'].prop[1]`, 42]);
export default {
SET_PROP(state, payload) {
let prop, value;
if (Array.isArray(payload)) {
[prop, value] = payload;
@l-portet
l-portet / slog.js
Last active July 6, 2021 20:46
Client-side silent log
window.slog = function (...args) {
if (!window.logsStack) {
window.logsStack = [];
window.printLogsStack = function () {
for (const logItem of window.logsStack) {
const [msg, lineDetails] = logItem;
console.log(msg);
console.log(lineDetails);
}
@l-portet
l-portet / custom-window-properties.js
Created May 17, 2021 22:17
Find all the custom properties created in the window object. Very useful to debug or reverse engineer a web app.
(() => {
let results;
let currentWindow;
let customizedWindow = {};
let iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
currentWindow = Object.getOwnPropertyNames(window);
results = currentWindow.filter(function (prop) {
return !iframe.contentWindow.hasOwnProperty(prop);