Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Always Working

Thomas Hunsaker thunsaker

💻
Always Working
View GitHub Profile
View main.py
import requests
from pyquery import PyQuery
import settings
if __name__ == '__main__':
# Log in to Alarm.com page
payload = {
'JavaScriptTest': '1',
'cookieTest': '1',
View FloatingActionButton.java
package your_package;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
@thunsaker
thunsaker / forms-bindable-picker.cs
Created May 26, 2015
Xamarin.Forms BindablePicker
View forms-bindable-picker.cs
// via https://forums.xamarin.com/discussion/19079/data-binding-for-the-items-source-of-a-picker-control
using System;
using System.Collections;
using Xamarin.Forms;
public class BindablePicker : Picker {
public BindablePicker() {
this.SelectedIndexChanged += OnSelectedIndexChanged;
}
@thunsaker
thunsaker / jQuery Mobile Dropdown Menu.js
Created Feb 11, 2011
Basic dropdown menu with arrow and animation
View jQuery Mobile Dropdown Menu.js
function openMenu() {
$(document).ready(function () {
if ($('#div_menu_links_wrapper').is(':hidden')) {
$('#img_menu_arrow_down').css('display', 'none');
$('#img_menu_arrow_up').css('display', 'block');
$('#div_menu_links_wrapper').slideDown('slow', function myfunction() { });
} else {
$('#img_menu_arrow_down').css('display', 'block');
$('#img_menu_arrow_up').css('display', 'none');
$('#div_menu_links_wrapper').slideUp('slow', function myfunction() { });
@thunsaker
thunsaker / Viewport - Fill Device Width.html
Created Feb 11, 2011
Code for mobile browsers to stretch the page to the width of the device.
View Viewport - Fill Device Width.html
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
@thunsaker
thunsaker / jQuery Reformat images for Mobile.js
Created Feb 11, 2011
Code to check the current device width and resize the image if it is too wide.
View jQuery Reformat images for Mobile.js
function reformatImages() {
$(document).ready(function () {
$('#div_content_inner_wrapper img').each(function () {
if ($(this).width() > $('body').width()) {
var newWidth = $('body').width() - 30;
$(this).css('width', newWidth);
}
$(this).css("border", "solid 1px gray");
$(this).css("padding", "2px");
});
@thunsaker
thunsaker / C# Mobile Master Page Switch.cs
Created Feb 14, 2011
C# Code to detect most mobile browsers and switch to another master page
View C# Mobile Master Page Switch.cs
protected void Page_PreInit(object sender, EventArgs e)
{
String mobileParam = Request.QueryString["m"] ?? "0";
if (int.Parse(mobileParam) == 1)
this.MasterPageFile = "mobile master page";
else
{
string u = Request.ServerVariables["HTTP_USER_AGENT"];
Regex b = new Regex(@"android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino", RegexOptions.IgnoreCase | RegexOptions.Multiline);
@thunsaker
thunsaker / Random Background Selector.js
Created Mar 6, 2011
Randomly Select a predefined list of background colors.
View Random Background Selector.js
$(document).ready(function () {
$('.links_wrapper a').hover(
function () {
var hue = Math.floor(Math.random() * 256);
switch (hue % 3) {
case 0:
// orange
$(this).css('background', '#FC9E00');
break;
case 1:
@thunsaker
thunsaker / header-center.css
Created Mar 23, 2011
Simple CSS centering
View header-center.css
.Header {
text-align: center;
}
@thunsaker
thunsaker / Favicon.html
Created Jun 9, 2011
Favicon code to be placed in the <head> tag. Uses png for modern browsers and ico for IE.
View Favicon.html
<link rel="icon" href="~/images/favicon.png">
<!--[if IE]>
<link rel="Shortcut Icon" href="~/images/favicon.ico" />
<![endif]-->