Skip to content

Instantly share code, notes, and snippets.

View dhtml's full-sized avatar

Anthony Ogundipe dhtml

View GitHub Profile
@dhtml
dhtml / DiscussionComposer.js
Last active June 4, 2024 04:34
Fix Composer Preview New Post On Flarum
import app from '../../forum/app';
import ComposerBody from './ComposerBody';
import extractText from '../../common/utils/extractText';
import Stream from '../../common/utils/Stream';
function minimizeComposerIfFullScreen(e) {
if (app.composer.isFullScreen()) {
app.composer.minimize();
e.stopPropagation();
}
@dhtml
dhtml / dirname-filename-basename.bat
Created March 26, 2023 20:41 — forked from Ciantic/dirname-filename-basename.bat
How to get filename, dirname, and basename in bat?
set filepath="C:\some path\having spaces.txt"
for /F "delims=" %%i in (%filepath%) do set dirname="%%~dpi"
for /F "delims=" %%i in (%filepath%) do set filename="%%~nxi"
for /F "delims=" %%i in (%filepath%) do set basename="%%~ni"
echo %dirname%
echo %filename%
echo %basename%
@dhtml
dhtml / close_window_by_title.cpp
Created March 18, 2023 10:43 — forked from sergnechaev/close_window_by_title.cpp
C++ WinAPI, close window by title
#include <windows.h>
#include <iostream>
int main(int argc, char* argv[]) {
if (argc <= 1) {
std::cerr << "ERROR: Please, specify the window title to close" << std::endl;
return EXIT_FAILURE;
@dhtml
dhtml / BITS_DN.CMD
Created March 6, 2023 20:21 — forked from WiVi71/BITS_DN.CMD
Simple batch file script to download file with progress bar using BITSAdmin
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /F %%A IN ('COPY /Z "%~DPF0" NUL') DO SET "CR=%%A"
FOR /F %%B IN ('ECHO PROMPT $H ^| CMD') DO SET "BS=%%B"
(SET \N=^
%=_Empty_Line_=%
)
:BITS_DN
IF NOT [%2] == [] IF [%3] == [] GOTO BITS_SET
@dhtml
dhtml / gist:d6ff5565d0be9163dabf996cd8cde83f
Created May 12, 2021 23:08 — forked from segebee/gist:7dde9de8e70a207e6e19
Nigeria States and Local Government Areas JSON - codingsavvy.com
[{"state":{"name":"Abia State","id":1,"locals":[{"name":"Aba South","id":1},{"name":"Arochukwu","id":2},{"name":"Bende","id":3},{"name":"Ikwuano","id":4},{"name":"Isiala Ngwa North","id":5},{"name":"Isiala Ngwa South","id":6},{"name":"Isuikwuato","id":7},{"name":"Obi Ngwa","id":8},{"name":"Ohafia","id":9},{"name":"Osisioma","id":10},{"name":"Ugwunagbo","id":11},{"name":"Ukwa East","id":12},{"name":"Ukwa West","id":13},{"name":"Umuahia North","id":14},{"name":"Umuahia South","id":15},{"name":"Umu Nneochi","id":16}]}},{"state":{"name":"Adamawa State","id":2,"locals":[{"name":"Fufure","id":1},{"name":"Ganye","id":2},{"name":"Gayuk","id":3},{"name":"Gombi","id":4},{"name":"Grie","id":5},{"name":"Hong","id":6},{"name":"Jada","id":7},{"name":"Lamurde","id":8},{"name":"Madagali","id":9},{"name":"Maiha","id":10},{"name":"Mayo Belwa","id":11},{"name":"Michika","id":12},{"name":"Mubi North","id":13},{"name":"Mubi South","id":14},{"name":"Numan","id":15},{"name":"Shelleng","id":16},{"name":"Song","id":17},{"name":"Toung
@dhtml
dhtml / ThrottleRequests.php
Created November 17, 2020 11:52 — forked from developerdino/ThrottleRequests.php
Lumen Middleware for rate limiting - based on Laravel's implementation.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
use Illuminate\Cache\RateLimiter;
class ThrottleRequests
{