- 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
# 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
//! 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
# 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
// 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
// getOfferClasses() | |
// | |
// Returns an array that represents the _types_ of plans (i.e. offer classes) that should be offered to the | |
// customer. An empty array is returned if an offer class cannot be determined due to a coding error and the | |
// caller needs to handle accordingly. | |
// | |
// Parameters: | |
// custSegment - String customer segment ('A'-Port, 'B'-New, 'C'-Migrator, 'D'-Legacy, 'E'-Inner Circle) | |
// deviceType - String identifying type of device ('byo'-BYOD, 'c_pl'-Certified Preloved, 'new'-New Device) | |
// isAppleICDevice - Boolean true if the device is Apple and qualified for an Inner Circle plan |
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
// cardInfo() | |
// | |
// Determines if a credit card number is valid and returns the name of the issuing network. When | |
// passed a purported card number as a candidate if the card number is valid, the cardInfo() | |
// function returns a boolean flag ('isValid') indicating if the card is a valid number and a | |
// string ('network') containing the name of the issuing network. Card validity is determined | |
// based upon the card number length and Luhn check digit value. Valid card lengths are based | |
// upon the card lengths valid for a given issuing network. The Luhn check digit is calculated | |
// using the Luhn algorithm. The function contains a static table ('IINData') that defines the | |
// supported issuing network. The table is not a complete list--it is only meant to contain |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
// Configuration values that are global to the store. These would need |
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
// Configuration values that are global to the store. These would need | |
// some sort of a Magento dialog to allow the business team to maintain | |
// them. Values are stored in cents to avoid JavaScript floating point | |
// issues | |
// | |
// standardShippingRate | |
// The amount of shipping that should be charged on a per item | |
// basis unless the individual SKU has a special shipping charge | |
// freeShippingThreshold | |
// The amount of the sub-total of the cart of the items that do |
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
/* Control Flow 5 - Concurrency Limited Functions Using an Array of Functions and Callbacks | |
* | |
* Based on: | |
* - http://book.mixu.net/node/ch7.html | |
* - https://github.com/mixu | |
* | |
* The 'Array.prototype.slice.call(arguments)' usage is a JavaScript trick and explained here: | |
* - http://mariapacana.tumblr.com/post/79170518832/javascript-tricks | |
* - http://stackoverflow.com/questions/7056925/how-does-array-prototype-slice-call-work | |
* |
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
/* Control Flow 4 - Serial Execution of an Array of Callback Functions | |
* | |
* Based on: | |
* - http://book.mixu.net/node/ch7.html | |
* - https://github.com/mixu | |
* | |
* Revised based upon comments from 'lanzz' to use 'process.nextTick(next)' instead of 'next()' | |
* Revised based upon comments from 'Israel' to use "typeof(callback) != 'undefined'" | |
* | |
* The 'Array.prototype.slice.call(arguments)' usage is a JavaScript trick and explained here: |
NewerOlder