Skip to content

Instantly share code, notes, and snippets.

View junebash's full-sized avatar

June Bash junebash

View GitHub Profile
@junebash
junebash / .svimrc
Last active March 18, 2018 02:54
sVimrc
map "g h" NOTHING
map "g H" homePage
@junebash
junebash / JRB_PlaybackHalftime.lua
Last active May 14, 2018 19:48
Play back at half-time REAPER script
--[[
toggle transport playrate between 0.5 and 1.0;
sets master transport playback rate to 0.5
if currently at 0.5, sets to 1.0
by Jon Bash (@jonbash, www.jonbash.com)
]]--
playrate = reaper.Master_GetPlayRateAtTime(0)
@junebash
junebash / keybase.md
Created May 14, 2019 23:48
Keybase ID thingy

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

//: ## version that only accepts positive values
//:
//: This version follows the instructions of only working for positive values of sum and product
func sumAndProduct(sum: Int, product: Int) -> [Int] {
for x in 1...sum/2 {
let y = sum - x
if x * y == product {
return [x, y]
}
@junebash
junebash / u1s2-codingChallenge.swift
Last active October 9, 2019 19:03
Unit 1 Sprint 2 Swift Coding Challenge (2019-10-09 Wed)
// INCOMPLETE AS OF 2019-10-09 08:46
func heightChecker(_ heights: [Int]) -> Int {
// handle invalid list length
if heights.count < 1 || heights.count > 100 {
print("List is too long or short; must have between 1 and 100 students (inclusive).")
return 0
}
var wrongStudents: [(index: Int, height: Int)] = []
@junebash
junebash / u2s1-codingChallenge.swift
Last active November 8, 2019 17:48
Lambda School Unit 2 Sprint 1 Coding Challenge
import Foundation
/*
Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.
Sort the elements of arr1 such that the relative ordering of items in arr1 are the same as in arr2. Elements that don't appear in arr2 should be placed at the end of arr1 in ascending order.
Example 1:
@junebash
junebash / FizzBuzz.swift
Created November 6, 2019 16:22
Coding Challenge U2S2 (2019-11-06)
func fizzBuzz(_ n: Int) -> [String] {
if n < 1 {
return []
}
var output = [String]()
for i in 1...n {
var stringForI: String = ""
if i % 3 == 0 {
stringForI += "Fizz"
@junebash
junebash / FizzBuzz.swift
Created November 6, 2019 16:22
Coding Challenge U2S2 (2019-11-06)
func fizzBuzz(_ n: Int) -> [String] {
if n < 1 {
return []
}
var output = [String]()
for i in 1...n {
var stringForI: String = ""
if i % 3 == 0 {
stringForI += "Fizz"
@junebash
junebash / CGExtensions.swift
Last active August 21, 2020 15:20
CGContext + Add Curved Polygon (+ vector helper methods) — Core Graphics extensions
//
// CGExtensions.swift
//
// Created by Jon Bash on 2019-11-06.
// Copyright © 2019 Jon Bash. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
@junebash
junebash / Sum.swift
Created November 13, 2019 16:18
u2s3-codingChallenge - Sum
func indicesToSum(from array: [Int], to target: Int) -> [Int] {
for i in 1 ..< array.count {
for j in 0 ..< i {
if array[i] + array[j] == target { return [j,i] }
}
}
print("ERROR: No sum possible!")
return []
}