Skip to content

Instantly share code, notes, and snippets.

💰

Adrian Mohnacs amohnacs15

💰
Block or report user

Report or block amohnacs15

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
@amohnacs15
amohnacs15 / basic-auth.swift
Created Aug 27, 2017 — forked from armstrongnate/basic-auth.swift
HTTP Basic Authentication using NSURLSession in swift
View basic-auth.swift
import Foundation
let config = NSURLSessionConfiguration.defaultSessionConfiguration()
let userPasswordString = "username@gmail.com:password"
let userPasswordData = userPasswordString.dataUsingEncoding(NSUTF8StringEncoding)
let base64EncodedCredential = userPasswordData!.base64EncodedStringWithOptions(nil)
let authString = "Basic \(base64EncodedCredential)"
config.HTTPAdditionalHeaders = ["Authorization" : authString]
let session = NSURLSession(configuration: config)
View gist:7df67d3f733f6f317b23
//Authored by: Adrian and Charlie
package stopwatch;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.KeyEvent;
You can’t perform that action at this time.