Skip to content

Instantly share code, notes, and snippets.

View thunsaker's full-sized avatar
💻
Always Working

Thomas Hunsaker thunsaker

💻
Always Working
View GitHub Profile
@romannurik
romannurik / DashboardLayout.java
Created March 23, 2011 05:06
A custom Android layout class that arranges children in a grid-like manner, optimizing for even horizontal and vertical whitespace.
/*
* ATTENTION:
*
* This layout is now maintained in the `iosched' code.google.com project:
*
* http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/ui/widget/DashboardLayout.java
*
*/
/*
@bentruyman
bentruyman / Custom.css
Created August 17, 2011 00:30
IR_Black Theme for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@tistaharahap
tistaharahap / gist:1202974
Created September 8, 2011 08:57
HMAC-SHA1 Utility for Android
public static String sha1(String s, String keyString) throws
UnsupportedEncodingException, NoSuchAlgorithmException,
InvalidKeyException {
SecretKeySpec key = new SecretKeySpec((keyString).getBytes("UTF-8"), "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(key);
byte[] bytes = mac.doFinal(s.getBytes("UTF-8"));
@cblunt
cblunt / MaskedImageView.java
Created July 25, 2012 11:22
Android MaskedImageView - Uses the Background resource as a mask for the src bitmap. If set, foregroundBitmap is overlaid on top of the masked image.
package com.example;
import android.content.Context;
import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.NinePatchDrawable;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;
@davemasse
davemasse / main.py
Created September 8, 2012 01:59
Set Dropcam status based on Alarm.com arming status
import requests
from pyquery import PyQuery
import settings
if __name__ == '__main__':
# Log in to Alarm.com page
payload = {
'JavaScriptTest': '1',
'cookieTest': '1',
@thunsaker
thunsaker / caclulateDistance.sql
Created September 10, 2012 22:24
Calculate Distance Between 2 GPS Coordinates
CREATE FUNCTION [dbo].[CalculateDistanceBetweenGPSCoordinates](
@Latitude1 float,
@Longitude1 float,
@Latitude2 float,
@Longitude2 float,
@ReturnUnits char(2) = 'MI'
)
RETURNS float
AS
BEGIN
@gerryster
gerryster / us_geo_chart_google
Created December 8, 2012 23:13
US State Map using the GeoChart from the Google Chart Tools
// GeoChart from https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart
// Try out by pasting code into: https://code.google.com/apis/ajax/playground/?type=visualization#geo_chart
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['State', 'Foo Factor'],
['US-IL', 200],
['US-IN', 300],
['US-IA', 20],
@ChrisRisner
ChrisRisner / blobs.delete.js
Last active December 15, 2015 13:19
Blob Storage
var azure = require('azure');
function del(id, user, request) {
var accountName = 'accountname';
var accountKey = 'accountkey';
var host = accountName + '.blob.core.windows.net';
var blobService = azure.createBlobService(accountName, accountKey, host);
blobService.deleteBlob(request.parameters.containerName,
@ficusk
ficusk / GsonRequest.java
Last active April 9, 2024 09:03
A Volley adapter for JSON requests that will be parsed into Java objects by Gson.
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
public void PutBlob(String containerName, String blobName)
{
String requestMethod = "PUT";
String urlPath = String.Format("{0}/{1}", containerName, blobName);
String storageServiceVersion = "2012-02-12";
String dateInRfc1123Format = DateTime.UtcNow.ToString("R", CultureInfo.InvariantCulture);