Skip to content

Instantly share code, notes, and snippets.

View bh3605's full-sized avatar

Bryson Hair bh3605

View GitHub Profile
@bh3605
bh3605 / setFilter.vb
Created August 12, 2015 11:34
Hides sections of data points in a data table and returns a modified copy
private function setExclusionFilter(table as DataTable) as DataTable
dim unit = cbxSelectUnit.text
dim xAxisName = table.columns(0).columnName
dim yAxisName = table.columns(1).columnName
dim unitExclusionRegions = from row in exclusionRegions
where row.field(Of String)("UnitID") = unit and row.field(Of Boolean)("Active") = true
select axis = row.field(Of Char)("Axis"), low = row.field(Of Double)("Low"), high = row.field(Of Double)("High")
dim query as String = ""
@bh3605
bh3605 / VBCompileDateCreator.vb
Last active August 29, 2015 14:27
Figures out application compile date
const PeHeaderOffset as integer = 60
const LinkerTimestampOffset as integer = 8
dim filePath = System.Reflection.Assembly.GetExecutingAssembly().location
dim b(2047) as byte
dim s as IO.FileStream = new IO.FileStream(filePath, IO.FileMode.Open, IO.FileAccess.Read)
try
s.Read(b, 0, 2048)
finally
@bh3605
bh3605 / StructToObjectConverter.vb
Last active August 29, 2015 14:27
Builds an object type from a struct containing all of the variable members of the struct as properties with getters and setters
imports System.Reflection
imports System.Reflection.Emit
imports System.Threading
''' <summary>
''' The purpose of this class is to take a struct and build and return an object type containing all of
''' the variable members of the struct as properties with getters and setters. You can then make an
''' instance of the object type by calling activator.createinstance(type).
''' Usage: dim converter = new StructConverter()
''' dim structObjectType as Type = converter.buildDynamicProperties(GetType(YourStruct))
@bh3605
bh3605 / ListBoxTableFilter.js
Last active August 29, 2015 14:27
Overview of how filtering using a dropdown search for a listbox in asp.net
function search(e) {
var id = e.target.id;
var val = document.getElementById(id).value.toUpperCase();
var grid = document.getElementById("ct100_ContentPlaceHolder1_dropdownListings");
$('#ctl00_ContentPlaceHolder1_dropdownListings').find('tbody').find('tr').each(function (index, element) {
var blah = $(this).text().toUpperCase();
if ($(this).text().toUpperCase().indexOf(val) < 0)
$(this).hide();
else