Skip to content

Instantly share code, notes, and snippets.

View wilsonsilva's full-sized avatar

Wilson Silva wilsonsilva

View GitHub Profile
@wilsonsilva
wilsonsilva / rename_flutter_app_class.sh
Created June 9, 2023 10:14
Renames MyApp and MainApp to App in the Flutter app templates
#!/bin/bash
# Get the location of the Flutter SDK
flutter_path=$(which flutter)
# Check if Flutter SDK is found
if [[ -z "$flutter_path" ]]; then
echo "Flutter SDK not found. Please install Flutter and add it to your PATH."
exit 1
fi
@wilsonsilva
wilsonsilva / remove_flutter_debug_banner.sh
Last active June 9, 2023 10:08
Remove the debug banner from the Flutter app templates
#!/bin/bash
# Get the location of the Flutter SDK
flutter_path=$(which flutter)
# Check if Flutter SDK is found
if [[ -z "$flutter_path" ]]; then
echo "Flutter SDK not found. Please install Flutter and add it to your PATH."
exit 1
fi
@wilsonsilva
wilsonsilva / Get Title and URL.applescript
Created May 23, 2023 00:02 — forked from vitorgalvao/Get Title and URL.applescript
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Chromium variants include "Google Chrome", "Chromium", "Opera", "Vivaldi", "Brave Browser", "Microsoft Edge".
-- Specific editions are valid, including "Google Chrome Canary", "Microsoft Edge Dev".
-- "Google Chrome" Example:
tell application "Google Chrome" to return title of active tab of front window
library test_framework;
import 'package:unittest/unittest.dart';
// RSpec like framework
typedef Closure();
class Example {
String name;
Closure body;
@wilsonsilva
wilsonsilva / describe.sh
Created March 30, 2023 13:04
Describe code to ChatGPT
#!/bin/bash
# This script will describe the code of a Flutter app
# Get the path to the Flutter app
app_path=$(pwd)/lib
# Navigate to the app directory
cd $app_path
@wilsonsilva
wilsonsilva / nostr.rb
Created February 24, 2023 08:49
Ruby Nostr example usage
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require 'nostr'
require 'pry'
client = Nostr::Client.new
subscription = nil
@wilsonsilva
wilsonsilva / exs.sh
Last active May 13, 2022 05:11
Submit an exercise on Exercism without typing the filename
alias exs='exercism submit ${$(basename $PWD.go)//-/_}'
@wilsonsilva
wilsonsilva / install.sh
Created December 16, 2021 04:55
Install the latest Ruby version through asdf
brew update && \
asdf plugin update ruby && \
asdf install ruby 3.0.3
@wilsonsilva
wilsonsilva / attach.sh
Created October 23, 2020 11:08
Attach to running docker container by name
# Replace api_app_1 with the name of your container
docker inspect --format="{{.Id}}" api_app_1
@wilsonsilva
wilsonsilva / zeller.rb
Created June 18, 2020 22:47
Zeller's congruence algorithm in Ruby
# day is Numeric
# month is String
# year us Numeric
def zeller(day,month,year)
days = ['Saturday','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday']
case month
when 'January'