Skip to content

Instantly share code, notes, and snippets.

View RichLogan's full-sized avatar

Rich Logan RichLogan

View GitHub Profile
@RichLogan
RichLogan / usStates_option_bootstrap
Last active February 4, 2024 07:09
US states dropdown for horizontal form w/ Bootstrap 3
<div class="form-group">
<label for="state" class="col-sm-2 control-label">State</label>
<div class="col-sm-10">
<select class="form-control" id="state" name="state">
<option value="">N/A</option>
<option value="AK">Alaska</option>
<option value="AL">Alabama</option>
<option value="AR">Arkansas</option>
<option value="AZ">Arizona</option>
<option value="CA">California</option>
@RichLogan
RichLogan / gist:11384923
Last active August 29, 2015 14:00
Remove PYC files
find . -name "*.pyc" -exec git rm -f {} \;
#Thanks to http://yuji.wordpress.com/2010/10/29/git-remove-all-pyc/
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.get( "http://playpaloalto.com/api/v1/login", { "username": "fraferra@cisco.com", "password": "1" } ).done(function( data ) {
alert("Data Loaded: " + data['message']);
});
});
@RichLogan
RichLogan / smtp.py
Created May 8, 2014 18:30
Python SMTP Snippet
sender = '"NAME" <name@domain.com>'
recipient = '"NAME" <name@domain.com>'
subject = "Subject"
message = ""
server = smtplib.SMTP('smtp.server.com')
m = "From: %s\r\nTo: %s\r\nSubject: %s\r\nX-Mailer: YOUR_APPLICATION_URL\r\n\r\n" % (sender, recipient, subject)
server.sendmail(sender, recipient, m+message)
server.quit()
@RichLogan
RichLogan / gist:5909bc2756b442bf5d93
Created November 6, 2014 13:28
Get logged in Android user
// To Get
SharedPreferences account = getSharedPreferences("account", 0);
String username = account.getString("username", null);
//To Set
SharedPreferences account = getSharedPreferences("account", 0);
SharedPreferences.Editor edit = account.edit();
edit.putString("username", InsertUsernameHere);
edit.commit();
###Patient/Carer Homescreen
###Account Deactivation
1. Deactivate their account and not be able to log in
2. Choose between erasing all data or keeping
#####Details Kept
######Web
1. Register a test account
Context context = getApplicationContext();
CharSequence text = "TEXT HERE";
//Length
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, text, duration);
//Position
toast.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 100);
//Background Color
//toast.getView().setBackgroundColor(Color.RED);
toast.show();
@RichLogan
RichLogan / build.gradle
Last active August 29, 2015 14:13
JustHealth Gradle Build file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "justhealth.jhapp"
minSdkVersion 10
targetSdkVersion 21
gunicorn justHealthServer:app --error-logfile logs.txt --certfile=certificate.crt --keyfile=newPrivateKey.pem -b 0.0.0.0:5000 --ssl-version=3
"AU",31
"AT",10
"IL",2
"BS",1
"BE",6
"BR",36
"CA",28
"CL",1
"CN",24
"CK",1