Skip to content

Instantly share code, notes, and snippets.

View ckashby's full-sized avatar

C K Ashby ckashby

View GitHub Profile
students = [
{"lname": "Kalama", "fname": "Samuel"},
{"lname": "Kalani", "fname": "Shawn"},
{"lname": "Kona", "fname": "Sid"},
{"lname": "Kapena", "fname": "Stan"},
]
@ckashby
ckashby / bs4_checkbox_does_not_toggle
Created June 29, 2018 23:37
Test file to show Bootstrap 4.1.1 bug. Clicking on checkbox button's checkbox square is not toggling checkbox.
<!-- Load in Chrome Version 67.0.3396.87 (Official Build) (64-bit) on Mac OS 10.13.5 -->
<!-- Click on the white square in the button that is the checkbox. It will NOT toggle. Click on button toggles. -->
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary active">
<input type="checkbox" checked autocomplete="off"> Checkbox 1 (pre-checked)
</label>
<label class="btn btn-primary">
<input type="checkbox" autocomplete="off"> Checkbox 2
@ckashby
ckashby / Android Common Intents
Created August 8, 2014 21:54
Android - Common Implicit Intents
Phone Call
Permissions:
<uses-permission android:name="android.permission.CALL_PHONE" />
Intent:
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:0377778888"));
startActivity(callIntent);
@ckashby
ckashby / Action Bar 2 menu items
Created August 4, 2014 19:25
Action Bar 2 menu items
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/miCompose"
android:icon="@drawable/ic_compose"
android:showAsAction="ifRoom"
android:title="Compose">
</item>
<item
android:id="@+id/miProfile"
android:icon="@drawable/ic_profile"
@ckashby
ckashby / Android Navigation Strings
Created August 3, 2014 22:45
Android Navigation Strings
<string name="tasks_button">Tasks</string>
<string name="phone_button">Phone</string>
<string name="music_button">Music</string>
<string name="calendar_button">Calendar</string>
<string name="title_text_music">Welcome to Music</string>
<string name="title_text_calendar">Welcome to Calendar</string>
<string name="title_text_phone">Welcome to Phone</string>
<string name="title_text_tasks">Welcome to Tasks</string>
@ckashby
ckashby / gist:a840981eed03a5af0fa2
Created August 3, 2014 22:43
Android nested LinearLayouts
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MyActivity">
@ckashby
ckashby / gist:78fb434fed7cd78953ab
Created August 3, 2014 22:41
Android Switch / Case ...
@Override // this does not override a super class method. Whats up?
public void onClick(View view) {
switch (view.getId()) {
case R.id.taskButton: {
Intent intent = new Intent(this, TasksActivity.class);
startActivity(intent);
}
break;
EditText etValue = (EditText) findViewById(R.id.etValue);
etValue.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// Fires right as the text is being changed (even supplies the range of text)
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
Button btnExample = (Button) findViewById(R.id.btnExample);
btnExample.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Do something here
}
});
public void myClickHandler(View view) {
...
ConnectivityManager connMgr = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected()) {
// fetch data
} else {
// display error
}