Skip to content

Instantly share code, notes, and snippets.

View rodericj's full-sized avatar
🐔
chicken

Roderic Campbell rodericj

🐔
chicken
View GitHub Profile
@rodericj
rodericj / url components.swift
Last active February 7, 2018 19:07 — forked from gregheo/url components.swift
Fake URL + url encoded query paramaters
import Foundation
let encodedString = "data=%7B%0D%0A%22coffee%22%3A%20%22coffee%22%2C%0D%0A%22beer%22%3A%20%22beer%22%2C%0D%0A%22has_bylaws%22%3A%20true%0D%0A%7D%0D%0A"
guard let c = URLComponents(string: "http://fakenews.com/?" + encodedString) else {
fatalError("could not generate url components! :(")
}
for item in c.queryItems ?? [] {
print("Got key \(item.name) with value \(item.value)")

This is an adaptation of https://twitter.com/jasonneylon script.

In the terminal window, you can open your current repo (at the current branch) in your default browser.

My adaptation was adding options to view the commits, branches, pull requests or issues for the repo using one of the additional options (added support for wiki, settings, pulse, graphs, network):

[-h]  => View help
[-c]  => View commits
[-b]  => View branches
[-pr] => View pull requests