Skip to content

Instantly share code, notes, and snippets.

View ChrisMoney's full-sized avatar

Chris Weathers ChrisMoney

  • Onevested
  • St. Louis, MO
View GitHub Profile
@ChrisMoney
ChrisMoney / hash.cs
Last active September 21, 2015 16:13
Hash - C#
using System;
using System.Collections;
class Program
{
static Hashtable GetHashtable()
{
Hashtable hashtable = new Hashtable();
hashtable.Add(300, "Carrot");
// ----------------------------------------------------------------------------------------------
// Database Fetch for Jquery
//---------------------------------------------------------------------------------------------
// in this sample, and as described in the article,
// this is a simple method that will connect to the database,
// execute an SQL command and return data in form of a DataTable
public DataTable GetDataTable()
{
DataTable dataTable = new DataTable();
@ChrisMoney
ChrisMoney / restAPI.asmx
Last active September 15, 2015 19:44
Web Service - VB.NET
'Syntax for VB
'<System.Web.Script.Services.ScriptMethod()>
'<System.Web.Services.WebMethod()>
[WebMethod]
[ScriptMethod(UseHttpGet=true)]
public string MyNiftyMethod(int myint)
{
// ... code here
}
@ChrisMoney
ChrisMoney / clr.cs
Created August 27, 2015 22:10
CLR (Common Runtime Language SQL)
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public partial class UserDefinedFunctions
{
public const double SALES_TAX = .086;
[SqlFunction()]
public static SqlDouble addTax(SqlDouble originalAmount)
{
@ChrisMoney
ChrisMoney / globals_for_private_methods.vb
Created August 27, 2015 21:55
VB - Create Globals for Private Methods
Private _UserCount as Int32
Public Property UserCount() as Int32
Get
If ViewState("UserCount") Is Nothing Then
Return 0
Else
Return Convert.ToInt32(ViewState("UserCount"))
End If
End Get
Set (ByVal value as Int32)
@ChrisMoney
ChrisMoney / ultra-grid.vb
Created August 26, 2015 18:21
Ultra Web Grid - Infragistics
Imports BusinessLayer
Imports GlobalVBNet
Imports Infragistics.WebUI.UltraWebGrid
Imports Telerik.Web.UI
'**************** user leveling ****************
'none
'*************************************************
'for all of the buttons on the top of the division page, we need to make sure that the information can be viewed and NOT edited for a completed division (new 2/11/09) TSP 11/16/09
@ChrisMoney
ChrisMoney / get_cell_without_any_id.js
Last active August 29, 2015 14:27
JQuery - Get table row and cell without ID. For table use table ID, for grid use grid ID
<script type="text/javascript">
$(document).ready(function () {
// uwg is a grid ID.
// always use closest when selecting a specific row
$('[id$=uwgAssignedQualifyingEvents]').delegate("tr", "click", function(e) {
var lostEligibility = $(this).closest('tr').find('td:eq(6)').text();
if (lostEligibility.length > 1) {
//alert(lostEligibility);
$('[id$=btnAddToTournament]').prop("disabled", true);
$('[id$=btnReQualifyToTournament]').prop("disabled", true);
@ChrisMoney
ChrisMoney / dataSet_relationships.cs
Last active August 29, 2015 14:24
C# - Determine Relationship of elements in a list or array
// Subtract every number in an array
for(int i=0;i<arrayName.count;i++)
{
arrayName[i]=arrayName[i]-1;
}
// determine if elements are the same in an array
var l = arrayName.SelectMany(_ => _);
bool areSame = l.All(_ => l.FirstOrDefault() == _);
@ChrisMoney
ChrisMoney / force-upgrade.php
Created April 22, 2015 19:55
Force Wordpress Upgrade after migrating
<?php
/*
WordPress Force Upgrade Script
Copyright (C) 2006 Mark Jaquith
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
@ChrisMoney
ChrisMoney / selenium.cs
Created April 13, 2015 17:04
Unit Test - Selenium UI
OpenQA.Selenium;
OpenQA.Selenium.FireFox;
OpenQA.Selenium.Support.UI;
[TestMethod]
public void TestMethod() {
IWebDriver driver = new FireFoxDriver();
driver.Navigate().GoToUrl("http://localhost:8080/webpage");
IwebElement username = driver.FindElement(By.Id("username");