Skip to content

Instantly share code, notes, and snippets.

@MichalBryxi
MichalBryxi / components.my-component\.js
Last active May 6, 2024 10:44
async-await-shenanigans
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class extends Component {
@tracked foo = undefined;
@tracked bar = undefined;
@action
async clickMe() {
@akabe1
akabe1 / frida_multiple_unpinning.js
Last active May 6, 2024 10:44
Another Android ssl certificate pinning bypass for various methods
/* Android ssl certificate pinning bypass script for various methods
by Maurizio Siddu
Run with:
frida -U -f <APP_ID> -l frida_multiple_unpinning.js [--no-pause]
*/
setTimeout(function() {
Java.perform(function() {
console.log('');
@mayank99
mayank99 / $.js
Last active May 6, 2024 10:44
make your own `execa`-like shell with node built-ins
import { promisify } from 'node:util';
import { exec } from 'node:child_process';
const $ = async (strings, ...values) => {
try {
return (await promisify(exec)(String.raw({ raw: strings }, ...values))).stdout;
} catch {
return ''; // yolo
}
};
@mayank99
mayank99 / inline-workers.js
Last active May 6, 2024 10:44
Create a web worker in the same file where it's used
function createWorker(fn) {
const url = URL.createObjectURL(
new Blob([`\
onmessage = ({ data }) => {
const fn = ${fn.toString()};
const result = fn(...JSON.parse(data));
self.postMessage(result);
};
`])
);
@mayank99
mayank99 / mulberry.ts
Created March 25, 2022 23:23
A very simple mulberry cipher
const chars = [...'0123456789abcdefghijklmnopqrstuvwxyz'];
const charsMap = Object.fromEntries(chars.map((letter, i) => [letter, i]));
/**
* Function that encodes a string using mulberry32.
* @param what What do you want to encode?
* @param seed Pick a seed, any seed.
* @returns Encoded string.
*/
export const encode = (what: string, seed: number) => {
@mayank99
mayank99 / importCss.js
Created December 12, 2023 04:29
import attributes polyfill
async function importCss(url) {
try {
return await (new Function(`return import("${url}", { with: { type: "css" } })`))();
} catch {
try {
return await (new Function(`return import("${url}", { assert: { type: "css" } })`))();
} catch {
return fetch(url).then(res => res.text()).then(cssText => {
const stylesheet = new CSSStyleSheet();
@linuslundahl
linuslundahl / raycast-emoji-snippets.json
Created March 3, 2023 14:12
Raycast Emoji Snippets
[
{ "text": "0️⃣", "name": "0", "keyword": ":0:" },
{ "text": "1️⃣", "name": "1", "keyword": ":1:" },
{ "text": "🔟", "name": "10", "keyword": ":10:" },
{ "text": "💯", "name": "100", "keyword": ":100:" },
{ "text": "🥇", "name": "1st Place Medal", "keyword": ":1st-place-medal:" },
{ "text": "2️⃣", "name": "2", "keyword": ":2:" },
{ "text": "🥈", "name": "2nd Place Medal", "keyword": "2nd-place-medal:" },
{ "text": "3️⃣", "name": "3", "keyword": ":3:" },
{ "text": "🥉", "name": "3rd Place Medal", "keyword": ":3rd-place-medal:" },
httpProxy = require('http-proxy')
init_http_proxy_server = () =>
_remember_me_check_for_write_access_to_project = (opts) ->
opts = defaults opts,
project_id : required
remember_me : required
cb : required # cb(err, has_access)
account_id = undefined
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active May 6, 2024 10:42
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}