Skip to content

Instantly share code, notes, and snippets.

View sebastiancrossa's full-sized avatar
🚀
probably building something

Sebastian Crossa sebastiancrossa

🚀
probably building something
View GitHub Profile
@steven-tey
steven-tey / title-from-url.ts
Last active July 29, 2024 20:57
Get Title from URL
// Note: this gist is a part of this OSS project that I'm currently working on: https://github.com/steven-tey/dub
export default async function getTitleFromUrl (url: string) {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 2000); // timeout if it takes longer than 2 seconds
const title = await fetch(url, { signal: controller.signal })
.then((res) => {
clearTimeout(timeoutId);
return res.text();
})
@steven-tey
steven-tey / BlurImage.js
Last active September 23, 2022 02:45
BlurImage Component that Self-Updates Twitter Profile Pics with the Twitter API
// components/BlurImage.js
import Image from 'next/image';
import { useState, useEffect } from 'react';
import cn from 'clsx';
export default function BlurImage(props) {
const [isLoading, setLoading] = useState(true);
const [src, setSrc] = useState(props.src);
useEffect(() => setSrc(props.src), [props.src]); // update the `src` value when the `prop.src` value changes
<?
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
// License: MIT
//
:root {
--font-size: 15.5px;
--font-color: hsl(205, 23%, 16%);
--font-color-lighter: hsl(0, 0%, 40%);
--font-color-placeholder: hsl(0, 0%, 70%);
--link-color: hsl(203, 82%, 35%);
--selection-color: hsl(203, 100%, 74%);
--border-color: rgba(0, 0, 0, 0.08);
--subtle-border-color: rgba(0, 0, 0, 0.05);
--main-background-color: hsl(210, 9%, 98%);
@gjerokrsteski
gjerokrsteski / remove env file from git forever
Last active October 28, 2024 10:37
remove env file from git history forever
echo '.env' >> .gitignore
git rm -r --cached .env
git add .gitignore
git commit -m 'untracking .env'
git push origin master
@cpdean
cpdean / preonic.txt
Created November 22, 2017 14:40
easy reference of preonic default layout
Qwerty
,-----------------------------------------------------------------------------------.
| ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
|------+------+------+------+------+------+------+------+------+------+------+------|
| Tab | Q | W | E | R | T | Y | U | I | O | P | Del |
|------+------+------+------+------+-------------+------+------+------+------+------|
| Esc | A | S | D | F | G | H | J | K | L | ; | " |
|------+------+------+------+------+------|------+------+------+------+------+------|
| Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
|------+------+------+------+------+------+------+------+------+------+------+------|
@PurpleBooth
PurpleBooth / README-Template.md
Last active November 13, 2024 22:21
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@solenoid
solenoid / gist:1372386
Created November 17, 2011 04:49
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};