Skip to content

Instantly share code, notes, and snippets.

John johncodeos

Block or report user

Report or block johncodeos

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
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.linkedinsigninexample">
<uses-permission android:name="android.permission.INTERNET" />
// ...
</manifest>
View LinkedInConstants.swift
struct LinkedInConstants {
static let CLIENT_ID = "MY_CLIENT_ID"
static let CLIENT_SECRET = "MY_CLIENT_SECRET"
static let REDIRECT_URI = "MY_REDIRECT_URI"
static let SCOPE = "r_liteprofile%20r_emailaddress" //Get lite profile info and e-mail address
static let AUTHURL = "https://www.linkedin.com/oauth/v2/authorization"
static let TOKENURL = "https://www.linkedin.com/oauth/v2/accessToken"
}
View SpotifyConstants.swift
struct SpotifyConstants {
static let CLIENT_ID = "MY_CLIENT_ID"
static let SESSION_KEY = "spotifySessionKey"
static let REDIRECT_URI = "MY_REDIRECT_URI"
static let SCOPE = "user-read-email"
}
View ButtonClickListener.kt
private var spotifyAccessToken: String? = null
private var spotifyAccessCode: String? = null
private var mCall: Call? = null
private val mOkHttpClient = OkHttpClient()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
spotify_login_btn.setOnClickListener {
View appleloginadddelegate.swift
extension LoginViewController: ASAuthorizationControllerDelegate {
// Authorization Failed
@available(iOS 13.0, *)
func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error) {
}
// Authorization Succeeded
@available(iOS 13.0, *)
View waterfallcollectionviewdelegate.swift
extension CollectionView: CHTCollectionViewDelegateWaterfallLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let itemWidth = itemsArray[indexPath.row].width
let itemHeight = itemsArray[indexPath.row].height
return CGSize(width: itemWidth, height: itemHeight)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, columnCountFor section: Int) -> Int {
return 2
View pulltorefresh.swift
var refControl = UIRefreshControl()
override func viewDidLoad() {
super.viewDidLoad()
// Setting up UIRefreshControl
refControl.tintColor = UIColor.white
refControl.addTarget(self, action: #selector(handleRefresh(refreshControl:)), for: UIControl.Event.valueChanged)
tableView.addSubview(refControl)
// Do other things...
View loadmorecellforrowat.swift
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "tableviewitemcellid", for: indexPath) as! TableViewItemCell
cell.itemLabel.text = itemsArray[indexPath.row]
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "tableviewloadingcellid", for: indexPath) as! TableViewLoadingCell
cell.activityIndicator.startAnimating()
return cell
}
View CountdownTimer.swift
class ViewController: UIViewController {
@IBOutlet var timerLabel: UILabel!
var timer: Timer!
override func viewDidLoad() {
super.viewDidLoad()
timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(UpdateTime), userInfo: nil, repeats: true) // Repeat "func Update() " every second and update the label
}
View RemoveCocoaPods.txt
sudo gem install cocoapods-deintegrate
sudo gem install cocoapods-clean
cd (path of your project)
pod deintegrate
pod clean
rm Podfile
You can’t perform that action at this time.