Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
simonewebdesign / pomodoro_timer.sh
Created February 11, 2025 17:35
Simple pomodoro timer Bash script (macOS)
#!/bin/bash
# Function to send a macOS notification
send_notification() {
osascript -e 'display notification "'"$1"'" with title "'"$2"'"'
}
# Function to display a countdown in the terminal
countdown_timer() {
local time_left=$1
@simonewebdesign
simonewebdesign / find.js
Created August 8, 2024 11:34
Find person recursively and play a sound when found
const sound = new Audio("data:audio/wav;base64,UklGRn47AABXQVZFZm10IBAAAAABAAIARKwAABCxAgAEABAAZGF0YSA6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAgABAAIAAQACAAIAAgABAAIAAgACAAIAAgACAAIAAgADAAIAAwADAAQAAgADAAIAAwAEAAQAAgAEAAIABAAEAAUAAwAEAAMABQADAAUABAAFAAUABgAEAAYABQAFAAUABgAFAAcABgAGAAcABwAEAAgABwAHAAYABwAHAAgABwAJAAgACQAGAAoABwAIAAsACwAHAAkACgAJAAoADQAKAAsACQAKAAoACwAIAAoACwANABEADAAKAA4ACgAIAAsADgAPAA0ADQANAA0ADgAPAA0ADAAOABQAEQAUABEADAAOABUAEAAWABUADwAPABUAFAAUABEAFwAaABAADAATABoADwAHAB0AIAAJAAIAGQAiAAIA+f8hADAA/P/o/y8ARwDt/8L//QENAkMG+wRJ+Oj5Rs/T3QO/v9Ssx1LRmqjdu62I9rBoiZ6yYZI+t+mSl79dqxvcB8vX+ZXqRxeXFyc8/ju5WB1Ta2khcKB8037/f59pL2mEVNJNN1ECQGA1txbA9W3kA9RDxUa+8KZRoIqLt4oggb2MNYU6j8CKlKDmnjq/1b6D3aPcN/3K/+ogsyK0Ojo6E0pyR95YhlTpW9tWGVWXThJMlkWnQJA3hCvOJC4ZahLPCA0AIPTg60bg2trE1T7OxMy1xi/H38J/xT3FZMohyqPTu9Wd34rlfe6F9YT/pQYpEGwW6BvmINMkzSdkKr4sxSvGKmIoqiQ1I2Ad1RtQFJoTnAklDBoBTgTN+Cj7H/FH9OnrDO+O6AjoweX35P7lBOa86eTmmezW6K3xJ
@simonewebdesign
simonewebdesign / ways.md
Created October 23, 2023 11:48
Ways to create multiple cursors in VSCodium (macOS)

Ways to create multiple cursors in VSCodium (macOS)

  • option+shift+drag
  • alt+click
  • cmd+opt+arrow up/down
@simonewebdesign
simonewebdesign / main.rb
Created September 19, 2022 18:32
Ruby script that updates all issues on a repo. You can use it to close all issues at once, for example. Uses the GitHub API via Octokit.rb.
require 'octokit'
client = Octokit::Client.new access_token: ENV['MY_GITHUB_PERSONAL_TOKEN']
client.auto_paginate = true
repo = 'ORG_NAME/REPO_NAME'
issues = client.issues repo
puts "Repo #{repo} has #{issues.length} issues."
@simonewebdesign
simonewebdesign / self.rb
Last active April 3, 2020 17:21
A self-reproducing Ruby program
#!/usr/bin/env ruby
puts File.read $0 # This is cheating, I know
@simonewebdesign
simonewebdesign / snake.p8
Created July 25, 2019 22:34
Snake in PICO-8 — work in progress
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
x=64
y=64
dir=nil
l=0
r=1
u=2
d=3
@simonewebdesign
simonewebdesign / example.scss
Last active June 18, 2019 16:36
Single line text ellipsis truncation SCSS Mixin
.my-class {
@include single-line-truncate;
}
@simonewebdesign
simonewebdesign / README.md
Last active March 3, 2022 12:11
Easy Search & Replace on an entire file (or STDIN) using sed

Even better is probably to have a script.sh file which looks like this (same thing but more readable):

#!/bin/bash
sed "s/FNAME/Simone/g;\
     s/LNAME/Vittori/g;\
     s/EMAIL/[email protected]/g;"

Just chmod +x script.sh and then use it like:

@simonewebdesign
simonewebdesign / add-label.sh
Last active October 9, 2018 15:58
Add one or more labels to a GitHub pull request or issue, using GitHub API
#!/bin/bash
# This program adds one or more labels to a GitHub issue/PR
username=
owner=
repo=
issue_or_pr_number=
curl -s https://api.github.com/repos/$owner/$repo/issues/$issue_or_pr_number/labels \
@simonewebdesign
simonewebdesign / index.js
Created June 5, 2018 16:21
JavaScript Array.toSentence - inspired by Ruby's Array#to_sentence
// Transforms an array into a sentence.
// Example:
// toSentence(['apples', 'oranges', 'melons']);
// >> "apples, oranges and melons."
export function toSentence(arr) {
if (arr.length === 0) return '';
return arr.length > 1
? `${arr.slice(0, arr.length - 1).join(', ')} and ${arr.slice(-1)}.`
: `${arr[0]}.`;