Skip to content

Instantly share code, notes, and snippets.

Brandon Lehr blehr

Block or report user

Report or block blehr

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
@blehr
blehr / accelerometer.dart
Created Jul 5, 2019
Using the Accelerometer in Flutter
View accelerometer.dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:sensors/sensors.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@blehr
blehr / docker-compose.yml
Created Nov 7, 2018
docker-compose.yml dotnet, nginx, let's encrypt
View docker-compose.yml
version: '2'
services:
app:
build:
context: ./
dockerfile: Dockerfile
https-portal:
image: steveltn/https-portal:1
ports:
@blehr
blehr / dockerfile
Created Nov 7, 2018
dotnet core 2.1 dockerfile
View dockerfile
FROM microsoft/dotnet:2.1-sdk AS build-env
WORKDIR /app
# Copy csproj and restore
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
View DateMask.java
package com.blehr.datepickerexample;
import android.text.Editable;
import android.text.TextWatcher;
import java.util.Locale;
public class DateMask implements TextWatcher {
private static final int MAX_LENGTH = 8;
View MyFragment.java
package com.blehr.datepickerexample;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
View SsnMask.java
package com.blehr.datepickerexample;
import android.text.Editable;
import android.text.TextWatcher;
import java.util.Locale;
public class SsnMask implements TextWatcher {
private static final int MAX_LENGTH = 9;
@blehr
blehr / DatePickerFragment.java
Last active Aug 19, 2018
DatePickerFragment sending results to initiating fragment
View DatePickerFragment.java
public class DatePickerFragment extends AppCompatDialogFragment implements DatePickerDialog.OnDateSetListener {
private static final String TAG = "DatePickerFragment";
final Calendar c = Calendar.getInstance();
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Set the current date as the default date
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
@blehr
blehr / MyFragment.java
Last active Aug 19, 2018
Calling a DatePickerFragment from a fragment
View MyFragment.java
public class MyFragment extends Fragment {
EditText dateOfBirthET;
String selectedDate;
public static final int REQUEST_CODE = 11; // Used to identify the result
private OnFragmentInteractionListener mListener;
public MyFragment() {
// Required empty public constructor
View datepicker_custom_input.js
import React, { Component } from 'react';
import moment from 'moment';
// import { formatDateInputs } from '../../utils/helper_functions';
const formatDateInputs = (value) => {
let input = value || '';
input = input.replace(/\D/g, '');
input = input.substring(0, 8);
const size = input.length;
View render_date_picker.js
import React, { Component } from 'react';
import DatePicker from 'react-datepicker';
import moment from 'moment';
import 'react-datepicker/dist/react-datepicker.css';
import DatePickerCustomInput from './datepicker_custom_input';
class RenderDatePicker extends Component {
constructor(props) {
You can’t perform that action at this time.