Skip to content

Instantly share code, notes, and snippets.

View MatthewZaso's full-sized avatar

Matthew Zaso MatthewZaso

View GitHub Profile
@MatthewZaso
MatthewZaso / install-nvm-update-node.sh
Last active April 14, 2023 22:42
Automate the installation of both NVM and the currently defined .nvmrc node version
#!/bin/bash
export NVM_DIR=$HOME/.nvm;
source $NVM_DIR/nvm.sh;
# Check if xcode command line tools are installed (required)
if xcode-select -p &> /dev/null && xcrun --version &> /dev/null; then
echo "XCode command line tools are installed ✅"
else
echo "XCode command line tools need to first be installed. Please install them at the next prompt and then run this script again."
@MatthewZaso
MatthewZaso / onbrand-custom-nav.js
Created May 15, 2020 17:21
gtm-js/uberflip email submission js
/* You should be able to use this function as-is */
function recordGtmEmailSubmission(email) {
return new Promise((resolve, reject) => {
if (window.IntercomGTM && window.IntercomGTM.pageviewId) {
resolve(window.IntercomGTM.recordEmailSubmissionWithOptions({
email: email,
createQualifiedProspect: true,
pageViewId: window.IntercomGTM.pageviewId,
opts: {
source: "marketo-form",
@MatthewZaso
MatthewZaso / Objective-C Example (No ARC)
Created January 18, 2013 19:17
This code example is an Objective-C one that I wrote before ARC was implemented into iOS. I have now ventured into ARC-enabled projects as well, and can see it's benefits. This project though was for my "Rise and Shine" app, and is getting data from chosen API's and displaying them to the user.
//
// Default_VC.m
// Rise and Shine
//
// Created by new user on 11/2/11.
// Copyright 2011 Matthew Zaso. All rights reserved.
//
#import "Default_VC.h"
@MatthewZaso
MatthewZaso / PHP and MySQL Code Example
Created January 18, 2013 19:05
This code example is from my "Yahtzee" game project. It shows the interaction between the PHP code and my MySQL database in the business layer of my server architecture. MySQLi prepared statements are used for obvious security reasons.
<?php
function getChatData($roomNum){
//need to pass in room number
$room=$roomNum;
//we could have an arg coming in as the gameId so I only get back
//the chat for that game...
//for now, this is what the json spitting out would look like:
@MatthewZaso
MatthewZaso / CMS and RSS parsing PHP Example
Created January 18, 2013 18:57
This example is of some PHP that I wrote for my Content Management System project. It is a set of functions focused around parsing local RSS/XML files using a separate class
<?php
class P2_Utils
{
// +++++++++++++++++++++++++++++++++++++++++++++++++++
// Create the page doctype and initiate the body and wrapper tags
// +++++++++++++++++++++++++++++++++++++++++++++++++++
public function page_header($title="Untitled", $style=""){
$string=<<<END
@MatthewZaso
MatthewZaso / Game Functions JavaScript Example
Created January 18, 2013 18:54
This is an example of how I laid out some of my functions for my "Yahtzee" game project. It shows of my logic for in-game events and sequences.
var xhtmlns = "http://www.w3.org/1999/xhtml";
var svgns = "http://www.w3.org/2000/svg";
var BOARDX = 50; //starting pos of board
var BOARDY = 50; //look above
var boardArr = new Array(); //2d array [row][col]
var pieceArr = new Array(); //2d array [player][piece] (player is either 0 or 1)
var BOARDWIDTH = 8; //how many squares across
var BOARDHEIGHT = 8; //how many squares down
//the problem of dragging....
var myX; //hold my last pos.
@MatthewZaso
MatthewZaso / JavaScript Prototype JS Example
Created January 18, 2013 18:50
This is a Scorecard class that was made for my multiplayer "Yahtzee" project. It uses Prototype.js and creates a new instance of a scorecard dynamically using SVG.
//////////////////////////////////////////////////////
// Class: Scorecard //
// Object that holds data for the user's rolls //
//////////////////////////////////////////////////////
// Scorecard constructor
function Scorecard(x,y,side,player) {
this.x = x;
this.y = y;