Skip to content

Instantly share code, notes, and snippets.

View benjamintemitope's full-sized avatar
🎯
Focusing

Benjamin Franklin benjamintemitope

🎯
Focusing
View GitHub Profile
@BlueNexus
BlueNexus / python2pseudo.py
Last active May 10, 2024 11:05
Python to Pseudocode converter
import os.path
import re
'''
INSTRUCTIONS
1. Create a file with the following code
2. Put the file you want to convert into the same folder as it, and rename it to "py_file.py"
3. Add a "#F" comment to any lines in the code which have a function call that doesn't assign anything (so no =),
as the program cannot handle these convincingly
4. Run the converter file
@simonhamp
simonhamp / AppServiceProvider.php
Last active May 8, 2024 17:47
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@mlocati
mlocati / win10colors.cmd
Last active May 8, 2024 06:23
ANSI Colors in standard Windows 10 shell
@echo off
setlocal
call :setESC
cls
echo %ESC%[101;93m STYLES %ESC%[0m
echo ^<ESC^>[0m %ESC%[0mReset%ESC%[0m
echo ^<ESC^>[1m %ESC%[1mBold%ESC%[0m
echo ^<ESC^>[4m %ESC%[4mUnderline%ESC%[0m
@mariodian
mariodian / zte-sms-forwarder.sh
Last active December 26, 2023 04:52
ZTE 3G/4G Modem SMS Forwarder
#!/bin/bash
PUSHOVER_TOKEN="<token>"
PUSHOVER_USER="<user>"
# The list of blocked keywords
declare -a BLOCKED=("uber eats" "block another keyword")
URL=http://192.168.0.1
REFERER="$URL/index.html"
URL_SET="$URL/goform/goform_set_cmd_process"
@sohelamin
sohelamin / laravel-related-posts.php
Created December 3, 2015 11:31
Related posts in Laravel
@zed-dz
zed-dz / offline_mdn_docs.md
Created March 12, 2019 14:01
Offline MDN Docs
@peter-mcconnell
peter-mcconnell / singularize.php
Created March 25, 2014 08:48
PHP singularize
<?php
/**
* Singularize a string.
* Converts a word to english singular form.
*
* Usage example:
* {singularize "people"} # person
*/
function singularize ($params)
{
@lysender
lysender / htmx-allow-400-errors-swap-for-validation-errors.md
Created August 19, 2023 13:49
HTMX - Allow HTTP error 400 and 422 swap content to enable showing validation errors

Still a newbie to HTMX.

I was writing some form submit interaction and realized that HTMX won't swap/render if the HTTP status code is not 2xx.

For 404, 500 or 503 errors, I think it's fair enough.

For my use case, I'm returning error 400 or 422 for validation errors. I'm returning the form back with some error decorations for example.

According to the docs, I can change that behavior.

@seayxu
seayxu / Bootstrap Checkbox Select All Or Cancel
Last active August 19, 2023 05:12
Bootstrap Checkbox Select All Or Cancel
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bootstrap Table Checkbox Select All and Cancel</title>
<link href="//cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<h2>Bootstrap Table Checkbox Select All and Cancel</h2>
<table class="table table-striped">
@markjaquith
markjaquith / Laracon US 2023.md
Created July 20, 2023 21:29
Rough notes from Laracon US 2023

These notes are super rough, and I didn’t take notes for a couple sessions. Let me know if you found them useful or they helped you remember things presented at the conference! @markjaquith on Twitter.

Pest PHP

by Nuno Maduro

[!question] How do snapshots work in CI? Won’t there not be an existing snapshot when the tests run?

Cool new features