Skip to content

Instantly share code, notes, and snippets.

View bmc08gt's full-sized avatar

Brandon McAnsh bmc08gt

View GitHub Profile
@bmc08gt
bmc08gt / MailForm
Created December 10, 2013 02:14
Simple Mail SmtpServer Form
Imports System.Net.Mail
Public Class MailForm
' Email contents
Dim toEmail, subject, textBody As String
' Email credentials
Dim fromEmail, password As String
Private Sub SendButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendButton.Click
toEmail = toEmailTextBox.Text
@bmc08gt
bmc08gt / setup_android_studio.sh
Last active July 4, 2022 11:44
Android Studio bash installation script
#!/bin/bash
# only works atm if only one jdk package in downloads
DOWNLOADS=$HOME/Downloads
CURRENT_VERSION=$(java -version 2>&1)
JDK=` ls $DOWNLOADS | grep "jdk"`
STUDIO_URL=http://dl.google.com/android/studio/install/0.3.2/android-studio-bundle-132.893413-linux.tgz
if [ "uname -m" == "i386" -o "uname -m" == "i686" ]; then
ARCH=32
else
@bmc08gt
bmc08gt / make_aokp_env.sh
Last active January 1, 2016 02:09
Android Open Kang Project Environment Setup Bash Script
#!/bin/bash
cd $HOME
echo "Which dir to repo init in? (~/aokp/<dir name>)"
read dir
sudo apt-get install git-core gnupg flex bison gperf build-essential zip \
curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 \
libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib \
@bmc08gt
bmc08gt / ul_to_select.js
Created January 10, 2014 17:37
ul->selector in CSA Edit Page
// ==UserScript==
// @name ul->select
// Written by Brandon McAnsh (C) 2014
// @namespace localhost
// @include https://clientserviceadmin.com/Customer/Edit/*
// @version 1
// @grant none
// ==/UserScript==
$('.nav-list-boxed:nth-child(5)').each(function(){
var list=$(this),
@bmc08gt
bmc08gt / doTimeout.js
Created January 23, 2014 18:26
doTimeout plugin
//doTimeout plugin
(function($){var a={},c="doTimeout",d=Array.prototype.slice;$[c]=function(){return b.apply(window,[0].concat(d.call(arguments)))};$.fn[c]=function(){var f=d.call(arguments),e=b.apply(this,[c+f[0]].concat(f));return typeof f[0]==="number"||typeof f[1]==="number"?this:e};function b(l){var m=this,h,k={},g=l?$.fn:$,n=arguments,i=4,f=n[1],j=n[2],p=n[3];if(typeof f!=="string"){i--;f=l=0;j=n[1];p=n[2]}if(l){h=m.eq(0);h.data(l,k=h.data(l)||{})}else{if(f){k=a[f]||(a[f]={})}}k.id&&clearTimeout(k.id);delete k.id;function e(){if(l){h.removeData(l)}else{if(f){delete a[f]}}}function o(){k.id=setTimeout(function(){k.fn()},j)}if(p){k.fn=function(q){if(typeof p==="string"){p=g[p]}p.apply(m,d.call(n,i))===true&&!q?o():e()};o()}else{if(k.fn){j===undefined?e():k.fn(j===false);return true}else{e()}}}})(jQuery);
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl -L https://npmjs.org/install.sh | sh
mkdir ~/.nave
cd ~/.nave
wget http://github.com/isaacs/nave/raw/master/nave.sh
sudo ln -s $PWD/nave.sh /usr/local/bin/nave
nave usemain stable
public static class StorageInfo {
public final String path;
public final boolean readonly;
public final boolean removable;
public final int number;
StorageInfo(String path, boolean readonly, boolean removable, int number) {
this.path = path;
this.readonly = readonly;
public String getBestResolution() {
String[] resolutions = null;
String resolution = "720p";
String rawList = readSupportList(HDMI_SUPPORT_LIST);
if (rawList != null) {
resolutions = (rawList.substring(0, rawList.length()-1)).split("|");
}
if (resolutions != null) {
for (int i = 0; i < resolutions.size(); i++) {
if (resolutions[i].contains("*")) {
@bmc08gt
bmc08gt / designer.html
Created August 18, 2014 20:02
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;