Mou, the missing Markdown editor for web developers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ClientGate - a component that will only render on the client, where you can safely access browser only APIs | |
* | |
* Usage: `<ClientGate>{() => `Hello Client ${window.title}`}</ClientGate>` | |
* @see https://tkdodo.eu/blog/avoiding-hydration-mismatches-with-use-sync-external-store#usesyncexternalstore | |
*/ | |
const emptySubscribe = () => () => {}; | |
const ClientGate = ({ children }: React.PropsWithChildren) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
indexer: | |
stub_paths: | |
- "%application_root%/_ide_helper.php" | |
- "%application_root%/_ide_helper_models.php" | |
- "%application_root%/vendor/laravel/framework/src/Illuminate/Support/Facades" | |
- "%application_root%/vendor/laravel/framework/src/Illuminate/Database/Eloquent" | |
- "%application_root%/vendor/laravel/framework/src/Illuminate/Http" | |
- "%application_root%/vendor/laravel/framework/src/Illuminate/Routing" | |
- "%application_root%/vendor/laravel/framework/src/Illuminate/View" | |
- "%application_root%/vendor/laravel/framework/src/Illuminate/Foundation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# The provided ffmpeg command performs several operations: | |
#`-vf "scale=-1:720,setsar=1"`: The `-vf` option stands for "video filter" and allows you to apply various video processing operations. In this case, two filters are applied: | |
# - `scale=-1:720`: This filter scales the video vertically to a height of 720 pixels, while maintaining the original aspect ratio. The `-1` value for the width means that the width will be calculated automatically based on the new height. | |
# - `setsar=1`: This filter sets the sample aspect ratio (SAR) to 1, which ensures that the video is displayed with square pixels. | |
#`-c:v libx264`: This option specifies the video codec to be used for the output file. In this case, it's the x264 codec, which is a popular and widely-used H.264 video codec. | |
#`-crf 20`: The Constant Rate Factor (CRF) is a quality setting for the x264 codec. A lower CRF value (e.g., 20) results in higher quality and larger file size, while a higher CRF value (e.g., 28) results in lower qual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this function will work cross-browser for loading scripts asynchronously | |
function loadScript(src) { | |
return new Promise(function(resolve, reject) { | |
const s = document.createElement('script'); | |
let r = false; | |
s.type = 'text/javascript'; | |
s.src = src; | |
s.async = true; | |
s.onerror = function(err) { | |
reject(err, s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function json_response($code = 200, $message = null) | |
{ | |
// clear the old headers | |
header_remove(); | |
// set the actual code | |
http_response_code($code); | |
// set the header to make sure cache is forced | |
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://www.php.net/manual/en/function.get-browser.php#101125 | |
function getBrowser() { | |
$u_agent = $_SERVER['HTTP_USER_AGENT']; | |
$bname = 'Unknown'; | |
$platform = 'Unknown'; | |
$version= ""; | |
// First get the platform? | |
if (preg_match('/linux/i', $u_agent)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Slim\Http\Request; | |
use Slim\Http\Response; | |
use Slim\Http\Stream; | |
$app->get('/stream', function (Request $request, Response $response, array $args) { | |
// a 100mb file | |
$path = '../public/files/document.pdf'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
https://github.com/VFS/.hammerspoon | |
]]-- | |
--[[ | |
This is my attempt to implement a jumpcut replacement in Lua/Hammerspoon. | |
It monitors the clipboard/pasteboard for changes, and stores the strings you copy to the transfer area. | |
You can access this history on the menu (Unicode scissors icon). | |
Clicking on any item will add it to your transfer area. | |
If you open the menu while pressing option/alt, you will enter the Direct Paste Mode. This means that the selected item will be |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.fromEntries(new URLSearchParams(window.location.search).entries()) |