Skip to content

Instantly share code, notes, and snippets.

View giuseppeg's full-sized avatar
🌊
All is well.

Giuseppe giuseppeg

🌊
All is well.
View GitHub Profile
@giuseppeg
giuseppeg / _app.tsx
Last active February 16, 2023 22:01
Incremental TailwindCSS on Next.js
import Head from "next/head";
import * as React from "react";
import "../styles/global.css";
export default function MyApp({ Component, pageProps }) {
/*
Page components can add the tw property to the component page to enable Tailwind, eg:
AboutPage.tw = true;
export default function AboutPage { ... }
// cmd+j and paste then proceed with frame recording
// when you press start it'll automatically start recording too.
document.addEventListener('click', async e => {
if (e.target.closest('button[class*="ExportButton"]')) {
let button
while (!button) {
button = document.querySelector('[class^="Timer_container"] + button')
if (!button) {
await new Promise(r => setTimeout(r))
import { json } from "@remix-run/node";
import type { ZodIssue } from "zod";
import { z } from "zod";
type ActionData<T> = {
ok: false;
data: T;
errors: ZodIssue[];
};
// Adapted from https://github.com/go717franciswang/peerjs-chatroom
const CLIENT_MSG = {
CHAT: 1,
GET_MEMBERS: 2,
};
const SERVER_MSG = {
CHAT: 1,
MEMBERS: 2,
<snippet>
<content><![CDATA[
import ${1:just} from "just-${2:package}";
]]></content>
<tabTrigger>just</tabTrigger>
</snippet>
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract NFTLoremIpsum is ERC721, Ownable {
constructor() ERC721("Lorem Ipsum", "NFTLI") {}
uint public totalSupply;
// setup
let classes = ['a','b','c']
let counter = 0
el.classList.add(classes[counter])
function rotate() {
counter++
el.classList.replace(
classes[(counter-1) % classes.length],
classes[(counter) % classes.length]
window.navigator.mediaDevices
.getUserMedia({
audio: true,
video: false,
}).then(mediaStream => {
const rec = new MediaRecorder(mediaStream)
rec.start()
setTimeout(() => {
rec.stop()
alert('mime-type: ' + rec.mimeType)
  • Common setup for engineers with
    • laptop with encrypted hard drive
    • automatic updates (possibly forced, disabling delay)
    • password manager
    • 2FA everywhere
    • dedicated browser for development without extensions except for the ones approved by devsec ops
    • VPN to access internal properties
    • work (dedicate) GitHub account
    • rotate passwords and tokens / keys
  • remote dev machines on premise that can be kept secure and up to date by IT - might reduce chances to compromise engineer machine (accessible only via vpn)
function track(name) {
const dummy = /./;
dummy.toString = () => {
alert(`${name} was debugged`);
return 'tracked';
};
return dummy;
}
function test() {