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 Fragment1.kt
class Fragment1: Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val rootView = inflater.inflate(R.layout.fragment_1, container, false)
return rootView
}
}
View build.gradle
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
View AndroidYoutubePlayerActivity.kt
class AndroidYoutubePlayerActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_android_youtube_player)
third_party_player_view.getPlayerUiController().showFullscreenButton(true)
third_party_player_view.addYouTubePlayerListener(object : AbstractYouTubePlayerListener() {
override fun onReady(@NonNull youTubePlayer: YouTubePlayer) {
val videoId = "YE7VzlLtp-4"
View ScrollToTopButton.swift
var arrowView = UIView(frame: CGRect.zero)
let arrowImgView = UIImageView(frame: CGRect.zero)
override func viewDidLoad() {
super.viewDidLoad()
//ArrowView
arrowView.layer.cornerRadius = 25
arrowView.backgroundColor = UIColor.black
arrowView.layer.borderWidth = 1.5
View MainActivity.kt
class MainActivity : AppCompatActivity() {
lateinit var itemsCells: ArrayList<String?>
lateinit var adapter: Items_RVAdapter
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//** Set the data for our ArrayList
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.johncodeos.splashscreenexample">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.johncodeos.asktorate">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:name=".Application"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
View Extensions.swift
import DTCoreText
extension String {
//Use of DTCoreText library to convert html to String.
public func returnAttributedStringForHTMLString (fontFamily: String, fontName: String, fontSize: CGFloat, textColor: UIColor, textAlignment: CTTextAlignment) -> NSMutableAttributedString {
let encodedData = self.data(using: String.Encoding.utf8)!
let options = [
DTDefaultFontFamily:fontFamily,
DTDefaultFontName: fontName,
DTDefaultFontSize: fontSize,
@johncodeos
johncodeos / Extensions.swift
Last active Jul 9, 2019
Decode HTML to NSAttributedString without third party library
View Extensions.swift
extension String {
private var convertHtmlToNSAttributedString: NSAttributedString? {
guard let data = data(using: .utf8) else {
return nil
}
do {
return try NSAttributedString(data: data,options: [.documentType: NSAttributedString.DocumentType.html,.characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil)
}
catch {
print(error.localizedDescription)
View index.js
auth: {
twitter: {
consumer_key: "YOUR_API_KEY", // REQUIRED
consumer_secret: "YOUR_API_SECRET_KEY" // REQUIRED
}
}
You can’t perform that action at this time.