Skip to content

Instantly share code, notes, and snippets.

View myleshyson's full-sized avatar

Myles Hyson myleshyson

View GitHub Profile
@myleshyson
myleshyson / gist:7081cbded57a2651bd9c
Created September 22, 2015 14:25
Scroll Button Probs
$("#scroll").click(function(){
$(this).preventDefault;
$('html,body').animate({
scrollTop: $(".scroll-down").offset().top
}, 1000)
});
@myleshyson
myleshyson / readme.md
Last active December 22, 2016 15:06
Using QuickBooks Online WebHooks With Laravel

#Getting Set Up With QuickBooks

  1. If you haven't already, make an account with quickbooks here.
  2. Once you make an account sign in and go to MyApps, then create an app.
  3. Then in the nav under where it says your name, click on Sandbox and create a sandbox company.
  4. Once the app is created, go to your App dashboard and go to settings, then scroll till you see Webhooks. If you are working locally and using something like Larael Valet, you'll need to cd into your local site folder and run valet share. Reason being that QuickBooks needs a publically accesible url. Make sure to copy the https url and use that to point to where your endpoint code will run. Something like https://fde565689fgh.ngrok.io/some-uri. Quickbooks will send a post request to that url whenever one of the resources you specify changes.

#Getting Set Up On Your Site

  1. For starters, you'll need to have connected your app with quickbooks. I made a package that makes this really easy. You
@myleshyson
myleshyson / BlockRestrictor.js
Last active April 24, 2020 18:52
Restricting blocks to templates in gutenberg
const { data } = window.wp
const { select, dispatch, subscribe } = data
const { getEditedPostAttribute } = select('core/editor')
const { isTyping } = select('core/block-editor')
const { getBlockType } = select('core/blocks')
const { addBlockTypes, removeBlockTypes } = dispatch('core/blocks')
class BlockRestrictor {
/**
* Defines the map of block types and the templates they are restricted to.
@myleshyson
myleshyson / Command.swift
Last active July 10, 2024 20:36
Execute CLI Commands with Swift. Supports generating output, streaming output, and running sudo commands.
import Foundation
struct ShellCommand {
@discardableResult
static func stream(_ command: String) -> Int32 {
let outputPipe = Pipe()
let task = self.createProcess([command], outputPipe)
outputPipe.fileHandleForReading.readabilityHandler = { fileHandle in self.streamOutput(outputPipe, fileHandle) }
do {