- Http://www.linkedin.com/in/ptdecker
This file contains hidden or 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
| // serialNumInfo() | |
| // | |
| // Evaluates a mobile device serial number, determines its type (ESN, IMEI, MEID) and attempts | |
| // to check for validity if possible. | |
| // | |
| // When the passed purported serial number, the serialNumInfo() function returns a boolean flag | |
| // ('isValid') indicating the validity of the number along with 'numType' indicating the type of | |
| // serial number passed. The function expects the passed serialNumber to be not contain any | |
| // spaces and for hexadecimal values to be passed without a leading "0x" or "0h" prefix. | |
| // |
This file contains hidden or 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
| # Build production releases for all MacOS supported targets and documentation | |
| [macos] | |
| build-release: build-docs | |
| @echo Cleaning... | |
| @cargo clean {{cargo_args}} | |
| @echo "Building all release binaries for 'aarch64-apple-darwin' architecture..." | |
| @rustup target install aarch64-apple-darwin | |
| @cargo install {{cargo_args}} --bin my-project --profile=release --target=aarch64-apple-darwin --root release/macos/aarch64 --force --path . | |
| @echo "Building all release binaries for 'x86_64-apple-darwin' architecture..." | |
| @rustup target install x86_64-apple-darwin |
This file contains hidden or 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
| //! TOML Value Manipulation Demonstration | |
| //! | |
| //! This code is to supplement this excellent article: | |
| //! | |
| //! [Rust: Read, Write, and Modify .toml Files — Another way to handle User Set Environment Variables](https://medium.com/@itsuki.enjoy/rust-read-write-and-modify-toml-files-another-way-to-handle-user-set-environment-variables-27e1baf1a65f) | |
| //! | |
| //! This demo code assumes you have added additional entries to your ~/.cargo/config.toml file. Although, I used | |
| //! `foo` and `bar` instead of the `password` and `username` that the article uses. | |
| //! | |
| //! Put this code into `main.rs`. And, here is the corresponding `Cargo.toml` needed for this demo. |
This file contains hidden or 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
| # Assumes local main was current with remote main prior to the fuck up | |
| # Create a new branch containing prior local main + changes | |
| git checkout -b {local branch name} | |
| # Switch back to local main | |
| git checkout - | |
| # Delete local main (which also contains the additional changes) | |
| git branch -D main | |
| # Check out remote main (which matches what was local main before changes) | |
| git checkout main | |
| # Switch back to new branch which would contain the changes |
This file contains hidden or 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
| #[derive(Debug, Serialize, Deserialize)] | |
| pub struct ConsumerRequest { | |
| /// The unique identifier for the consumer record. This parameter is optional and only used | |
| /// when updating or deleting a consumer record. | |
| #[cfg(feature = "string-consumer-id")] | |
| pub consumer_id: Option<String>, | |
| #[cfg(not(feature = "string-consumer-id"))] | |
| pub consumer_id: Option<Uuid>, | |
| pub organization_id: Option<String>, | |
| trace_id: Option<Uuid>, |
This file contains hidden or 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
| impl ConsumerId { | |
| pub fn new() -> Self { | |
| #[cfg(not(feature = "string-consumer-id"))] | |
| let consumer_id = Uuid::new_v4(); | |
| #[cfg(feature = "string-consumer-id")] | |
| let consumer_id = { | |
| let length = 10; | |
| let mut rng = rand::thread_rng(); | |
| let letters: Vec<char> = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars().collect(); | |
| (0..length) |
OlderNewer