~evan-hoose/Snippets

Some random snippets I keep around.
 On branch master
 On branch master
 Changes to be committed:

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~evan-hoose/Snippets
read/write
git@git.sr.ht:~evan-hoose/Snippets

You can also use your local clone with git send-email.

#Some useful(?) code snippets.

This is literally just a collection of some bits and pieces that don't fit anywhere else.

##isPhoneNumber.php

PHP function to validate a phone number from untrusted input. That's all it does. I'm not a PHP expert, so I'd recommend you check over it yourself.

##shell.rs

Rust function to execute a command in a shell. Just pass it an &str for the command, and it'll push it on to sh -c. It'll only work in POSIX compatible environments, and if you take untrusted user input it could result in command injection. Also, it'll hold the thread until the command finishes.