Skip to content

Instantly share code, notes, and snippets.

Brad Brown imbradbrown

  • Murfreesboro, Tennessee
Block or report user

Report or block imbradbrown

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@imbradbrown
imbradbrown / WKWebView Anchors.swift
Created Apr 25, 2018
WKWebView scroll to anchor location useful if having to add header/footers that scroll with it
View WKWebView Anchors.swift
@IBOutlet var scrollView: UIScrollView!
var webView: WKWebView!
/// container for the webView in the storyboard
@IBOutlet var webViewContainer: UIView!
/// height of the container
@IBOutlet var webViewHeightConstraint: NSLayoutConstraint!
override func viewDidLoad() {
View Swift-WriteFile
var paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .allDomainsMask, true)
var root = paths.first
if let path = root?.appending("/image.jpg") {
do {
let url = URL(fileURLWithPath: path)
try UIImagePNGRepresentation(image)?.write(to: url, options: Data.WritingOptions.atomicWrite)
} catch {
return
}
}
@imbradbrown
imbradbrown / cygwin-copy-pasta.sh
Created Jun 2, 2016
Copy / Paste on Windows in Cygwin with Mac keyboard
View cygwin-copy-pasta.sh
#!/bin/bash
echo "stay next ^q stop undef start undef" >> ~/.bashrc
echo '"\C-v": paste-from-clipboard' >> ~/.inputrc
echo '"\C-z": copy-to-clipboard' >> ~/.inputrc
## Restart cygwin
@imbradbrown
imbradbrown / upload-ssec.sh
Last active Jan 11, 2019
Uploading to Amazon S3 from curl with Server Side Encrpytion - Customer Provided Key used. Note that this uses the Amazon Access Keys which should be used with care.
View upload-ssec.sh
#!/bin/bash
## file to upload.
S3_UPLOAD_FILE=some/path/file.txt
## Specify the bucket name here. This can be found in the S3 console
S3_BUCKET=bucket name here
## The desired path relative to the root of the bucket. All folders must be forward slash '/' separated
S3_DESTINATION_FILE=folder/folder2/file.txt
You can’t perform that action at this time.