Skip to content

Instantly share code, notes, and snippets.

View apjoex's full-sized avatar

Akinde-Peters Joseph apjoex

View GitHub Profile
let button = document.createElement('button');
button.textContent = "Start";
button.onclick = function () {
doSomeWork().then(value => {
alert(value);
}).catch(err => {
alert(err);
})
}
for view in (self.navigationController?.navigationBar.subviews)! {
if let findClass = NSClassFromString("_UINavigationBarContentView") {
if view.isKind(of: findClass) {
if let barView = self.navigationItem.leftBarButtonItem?.value(forKey: "view") as? UIView {
let highlightController = MDCFeatureHighlightViewController(highlightedView: barView, completion: completion)
highlightController.titleText = "Current location"
highlightController.bodyText = "Tap here to change pickup location to your current location"
highlightController.titleColor = UIColor.white
highlightController.bodyColor = UIColor.white
highlightController.outerHighlightColor = UIColor.darkGray.withAlphaComponent(kMDCFeatureHighlightOuterHighlightAlpha)
@apjoex
apjoex / gist:e88fd0ba6acc58cdeb6eea43d208581a
Created April 4, 2017 16:33
How to send data via broadcast intents
//Send a broadcast
String TAG = "your_custom_tag";
Intent intent = new Intent(TAG);
intent.putExtra("data_key","data_value");
getActivity().sendBroadcast(intent);
@apjoex
apjoex / Start.java
Created November 9, 2016 17:35
To show link with TabLayout and ViewPager
package com.project.rise;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
@apjoex
apjoex / CourseGridAdapter.java
Created September 2, 2016 15:36
Adapter for populating gridview
package adapters;
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;