Skip to content

Instantly share code, notes, and snippets.

@JHWelch
JHWelch / open-slack.sh
Last active January 8, 2024 20:58
Open Legacy Slack Interface Raycast script
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Open Slack
# @raycast.mode silent
# Optional parameters:
# @raycast.icon /Applications/Slack.app/Contents/Resources/electron.icns
@JHWelch
JHWelch / BinaryTestDivide.php
Created June 27, 2023 14:02
Experimental Laravel Command to binary divide tests to find problem causing test
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use ReflectionClass;
use Symfony\Component\Process\Process;
@JHWelch
JHWelch / unwip.sh
Created November 3, 2022 15:56
Unwip
# Undoes all WIP commits, will stop at last non-wip commit.
unwip () {
lastCommit=$(git log -1 --pretty=%B | cat)
if [ ${lastCommit:l} != "wip" ]; then
echo "Last commit is not a WIP."
else
count=0
while [ ${lastCommit:l} = "wip" ]
do
void main() {
print(_map(''));
print(_map('something'));
}
_map(String routingNumber) {
return {
if(routingNumber != '') 'routingNumber': routingNumber,
};
@JHWelch
JHWelch / mknotes.sh
Last active February 3, 2022 21:43
Make Notes Function
# Add notes.md to global .gitignore at ~/.gitignore
NOTES_DIR=~/Notes/Repos # Update to global note directory
mknotes() {
if test -f "./notes.md"; then
echo 'notes.md already exists in this directory'
return 1
fi
@JHWelch
JHWelch / dart-infinity.dart
Created January 12, 2022 18:23
Infinity in dart
void main() {
print(1 / 0);
print(0 / 0);
}
@JHWelch
JHWelch / twitter_mark_topics_not_interested.js
Created May 18, 2021 20:39
Mark topics on twitter "not interested" with some JS.
/*
* Mark all the topics visual on a Twitter page as "not interested".
* Someday maybe I'll reach the end.
*
* Currently I run from the console, will eventually write an extension.
*/
// From your feed
document
.querySelectorAll('[aria-label="Set as not interested"]')
@JHWelch
JHWelch / vscode-settings.jsonc
Created February 7, 2021 20:05
Auto Switch Dark/Light theme VSCode
// Settings.json
{
// ...
"window.autoDetectColorScheme": true,
"workbench.preferredDarkColorTheme": "Dracula Pro", // Dark Theme
"workbench.preferredLightColorTheme": "Atom One Light", // Light Theme
// ...
}
@JHWelch
JHWelch / NovaTextFieldLimitMacro.php
Last active March 18, 2021 20:28
Laravel Nova Text Field Limit Macro
<?php
/*
* Text Field Limit Macro
* Implementation of Str::limit Helper.
* Truncates a string after $limit characters and adds $end
* Can be added to NovaServiceProvider in boot()
*/
\Laravel\Nova\Fields\Text::macro('limit', function ($limit = 50, $end = '...') {
$this->displayUsing(
//$parameters.RootId should point to a "Root" container that wraps the entire WebBlock
var wbElement = document.getElementById($parameters.RootId).parentElement;
//Replace "OnParametersChanged" with whatever action you want to have run when
wbElement.reload = $actions.OnParametersChanged; // Note the lack of ()s, point to function, not result.