Skip to content

Instantly share code, notes, and snippets.

View cameronrye's full-sized avatar
⚒️
Crafting

Cameron Rye cameronrye

⚒️
Crafting
View GitHub Profile
@cameronrye
cameronrye / email.js
Created October 4, 2015 19:26
mailto: URLs in JavaScript
// http://xion.io/post/code/js-mailto-urls.html
function getMailtoUrl(to, subject, body) {
var args = [];
if (typeof subject !== 'undefined') {
args.push('subject=' + encodeURIComponent(subject));
}
if (typeof body !== 'undefined') {
args.push('body=' + encodeURIComponent(body))
}
@cameronrye
cameronrye / keybase.md
Created January 18, 2017 03:35
Keybase proof

Keybase proof

I hereby claim:

  • I am cameronrye on github.
  • I am cameronrye (https://keybase.io/cameronrye) on keybase.
  • I have a public key ASBkw8omUmFPvsZfwjoaufWba5hOsfgMG4Qu1dB4fCtlPgo

To claim this, I am signing this object:

@cameronrye
cameronrye / uuid.js
Last active January 25, 2017 19:11
Create GUID/UUID in JavaScript
function generateUUID() {
var d = new Date().getTime();
if(window.performance && typeof window.performance.now === "function"){
d += performance.now();
}
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (d + Math.random()*16)%16 | 0;
d = Math.floor(d/16);
return (c=='x' ? r : (r&0x3|0x8)).toString(16);
});
@cameronrye
cameronrye / valid-email.cs
Last active March 30, 2017 15:16
Email is Valid
public static bool EmailIsValid(string email)
{
const string expresion = "\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
return IsMatch(email, expresion) && Replace(email, expresion, string.Empty).Length == 0;
}
@cameronrye
cameronrye / gsap-resources.js
Created April 10, 2017 16:40
GASP Resources
// Position parameters
var tl = new TimelineLite();
tl.to(".orange", 1, {x:750})
//this just follows the first
.to(".green", 1, {x:750})
//there is a one second gap between these two tweens
.to(".blue", 1, {x:750}, "+=1")
//this goes to two seconds in
.to(".red", 1, {x:750}, "2")
_\/_ | _\/_
/o\\ \ / //o\
| .---. |
_|_______ -- / \ -- ______|__
`~^~^~^~^~^~^~^~^~^~^~^~`
@cameronrye
cameronrye / big-sur-beta-iso.sh
Last active June 23, 2020 06:52
Create macOS Big Sur Beta ISO Image
#!/usr/bin/env bash
# Create Disk Image
hdiutil create -o /tmp/BigSur.cdr -size 12000m -layout SPUD -fs HFS+J
# Mount it
hdiutil attach /tmp/BigSur.cdr.dmg -noverify -mountpoint /Volumes/install_build
# Create macOS Big Sur Installer
sudo /Applications/Install\ macOS\ Beta.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build --nointeraction
__..--''``---....___ _..._ __
/// //_.-' .-/"; ` ``<._ ``.''_ `. / // /
///_.-' _..--.'_ \ `( ) ) // //
/ (_..-' // (< _ ;_..__ ; `' / ///
/ // // // `-._,_)' // / ``--...____..-' /// / //