blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
625
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
47
| license_type
stringclasses 2
values | repo_name
stringlengths 5
116
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 643
values | visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 80.4k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 16
values | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_language
stringclasses 85
values | src_encoding
stringclasses 7
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 4
6.44M
| extension
stringclasses 17
values | content
stringlengths 4
6.44M
| duplicates
sequencelengths 1
9.02k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2484e67e445ffba0b02a5973ba289e7fb273212f | 59ee56c96230361ed29708287f5329ecb904ab95 | /CheetSheet2/ViewModels/Resources/NewtonViewModel.swift | 31366f7ed48697810872164a995dc2fa4292b6f9 | [] | no_license | KnowinkPublishing/CheetSheet | f66761c0ac30f2346d338b04d5b8abac4769d41e | 1495ca6f661df6249a8dc08da511a0d563b051ec | refs/heads/master | 2020-03-24T05:18:29.686404 | 2018-07-31T15:45:21 | 2018-07-31T15:45:21 | 128,666,281 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 1,606 | swift | //
// NewtonViewModel.swift
// CheetSheet2
//
// Created by Steven Suranie on 7/5/18.
// Copyright © 2018 Steven Suranie. All rights reserved.
//
import Foundation
import Alamofire
struct NewtonModel {
var myController = Controller.sharedInstance
var myConfig = csConfig()
typealias newtonEquationCompletion = (_ bSuccess: Bool, _ dictJSON: Dictionary<String, Any>, _ strErrMsg: String) -> Void
func getEquationResults(_ strEquation: String, _ strOperation: String, completion: @escaping newtonEquationCompletion) {
//construct path
let strPath = "/" + strOperation + "/" + strEquation
let myURLComponents = myController.apiManager.makeURLComponents("https", myConfig.newtonBaseURL, strPath, [:])
if let myURL = myURLComponents.url {
Alamofire.request(myURL).responseJSON(completionHandler: { response in
if let dictJSON = response.result.value as? Dictionary<String, Any> {
completion(true, dictJSON, "")
} else {
completion(false, [:], "There was a problem with the JSON request.")
}
})
}
/*
myController.apiManager.makeJSONCall("https", myConfig.newtonBaseURL, strPath, [:], [:], [:], completion: {(bSuccess, dictJSON, _, _) in
if bSuccess {
completion(bSuccess, dictJSON, "")
} else {
completion(bSuccess, dictJSON, "There was a problem with the JSON request.")
}
})
*/
}
}
| [
-1
] |
34dfd52ed7ac1e69fb282c9bb7e9be8877b472fe | 44f77455fa48a712986f7b40a88a232b0db0748b | /TopMusic/Controllers/CollectionViewController.swift | bc01a120e0b014589c4d37769ba8b269c42d931f | [] | no_license | jonmahei/TopMusic | 366c5e1653f589ec82126a03fdc2ac667cb8109b | 24c4a6878e204b8e6bce2ca35e93d7d1ac66ff64 | refs/heads/master | 2023-06-26T23:49:05.469250 | 2019-12-06T12:02:35 | 2019-12-06T12:02:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 3,606 | swift | //
// CollectionViewController.swift
// TopMusic
//
// Created by Jon-Martin Heiberg on 16/10/2019.
// Copyright © 2019 JMHeiberg. All rights reserved.
//
import UIKit
class CollectionViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
private var listView = false
private var lovedTracks: [Track] = []
private var selectedTrack: Track?
override func viewDidLoad() {
super.viewDidLoad()
WebAPIService.getTracks(albumId: nil, completion: { response in
if let tracks = response {
self.lovedTracks = tracks
self.collectionView.reloadData()
}
})
}
@IBAction func toggleGridView(_ sender: UIBarButtonItem) {
if (listView) {
listView = false
collectionView.reloadData()
}
}
@IBAction func toggleListView(_ sender: UIBarButtonItem) {
if (!listView) {
listView = true
collectionView.reloadData()
}
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
var size = CGSize(width: 0, height: 0)
if listView {
size.height = 50
size.width = collectionView.frame.width
} else {
// Inspired by https://stackoverflow.com/questions/31662155/how-to-change-uicollectionviewcell-size-programmatically-in-swift
if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
let itemsPerRow: CGFloat = 2
let padding: CGFloat = 15
let totalPadding = padding * (itemsPerRow - 1)
let individualPadding = totalPadding / itemsPerRow
let width = collectionView.frame.width / itemsPerRow - individualPadding
let height = width + 60
layout.minimumInteritemSpacing = padding
layout.minimumLineSpacing = padding
size.height = height
size.width = width
}
}
return size
}
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let vc = segue.destination as? DetailsViewController {
vc.albumId = selectedTrack!.idAlbum
}
}
// MARK: UICollectionViewDataSource
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return lovedTracks.count
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if listView {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "trackListCell", for: indexPath) as! ListViewCell
cell.load(with: lovedTracks[indexPath.row],rank: indexPath.row + 1)
return cell
} else {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "trackGridCell", for: indexPath) as! GridViewCell
cell.load(with: lovedTracks[indexPath.row],rank: indexPath.row + 1)
return cell
}
}
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectedTrack = lovedTracks[indexPath.row]
performSegue(withIdentifier: "showAlbum", sender: self)
}
}
| [
-1
] |
1bc683513296734939b0a962b503782e1bc26bcc | de05289a7ab09465d2048540c75ec0972b0f26de | /MemeMe/MemeDetailViewController.swift | 19a54b09228ac97e1a0b7975551e65008e08ba79 | [] | no_license | veraabad/MemeMe | e1893ec7b4170b1d2d8a51ab9623164500a2f75d | 1d4caf52aea3ae381bafcfd43165eccb56dde1bd | refs/heads/master | 2020-04-07T00:44:19.735756 | 2018-12-11T06:33:46 | 2018-12-11T06:33:46 | 157,916,300 | 0 | 0 | null | null | null | null | UTF-8 | Swift | false | false | 478 | swift | //
// MemeDetailViewController.swift
// MemeMe
//
// Created by Abad Vera on 12/3/18.
// Copyright © 2018 Abad Vera. All rights reserved.
//
import UIKit
class MemeDetailViewController: UIViewController {
@IBOutlet weak var memeImageView: UIImageView!
var meme: Meme?
override func viewDidLoad() {
super.viewDidLoad()
// Load memed image
if let meme = meme {
memeImageView.image = meme.memedImage
}
}
}
| [
-1
] |
75b8357dd19f1b889a9fb59fb4ce3df9ecc1df3f | 29447d279f82058a39d7d6c02ed97ad7ce937569 | /Fixtures/ModuleMaps/Transitive/packageA/Package.swift | a511c62f2af8a4aecdce088dce4f281412110d5d | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Swift-exception"
] | permissive | apple/swift-package-manager | 543a2fa53591d7441de4cb55c5580ae8881a5579 | 1826ef6b7d8578f13dbd6db0f631b2d7ee0ba274 | refs/heads/main | 2023-08-18T05:43:51.764484 | 2023-08-16T23:03:29 | 2023-08-17T22:27:58 | 44,840,041 | 10,534 | 1,777 | Apache-2.0 | 2023-09-14T21:53:38 | 2015-10-23T21:41:12 | Swift | UTF-8 | Swift | false | false | 282 | swift | // swift-tools-version:4.2
import PackageDescription
let package = Package(
name: "packageA",
dependencies: [
.package(url: "../packageB", from: "1.0.0"),
],
targets: [
.target(name: "packageA", dependencies: ["packageB"], path: "Sources"),
]
)
| [
-1
] |