Skip to content

Instantly share code, notes, and snippets.

View slaght's full-sized avatar
🧗‍♂️
Banished to devops forever

Brandon Slaght slaght

🧗‍♂️
Banished to devops forever
View GitHub Profile
@slaght
slaght / rps_snippet.js
Created June 30, 2023 17:21
String building method
function logResult(winningMove, losingMove, computerWins) {
console.log(winningMove + " beats " + losingMove + "! You " + (computerWins ? "lose" : "win") + "! \n Player: " + playerScore + " \n Computer: " + computerScore);
}
logResult(playerSelection, computerSelection, false);
@slaght
slaght / addSubview.swift
Created October 31, 2017 18:26
Add a subview to a parent container view and resize the parent to wrap the child
func addSubview(subView:UIView, toView parentView:UIView) {
parentView.addSubview(subView)
var viewBindingsDict = [String: AnyObject]()
viewBindingsDict["subView"] = subView
parentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[subView]|", options: [], metrics: nil, views: viewBindingsDict))
parentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[subView]|", options: [], metrics: nil, views: viewBindingsDict))
}
@slaght
slaght / analyzer.py
Created September 8, 2016 02:45
Tweet Stocks
import json
from textblob import TextBlob
linenum = 0
sentiment = []
Apple= []
AmericanExpress= []
BankofAmerica = []
Caterpillar = []