Skip to content

Instantly share code, notes, and snippets.

View musicm122's full-sized avatar
🏠
Working from home

Terrance Smith musicm122

🏠
Working from home
View GitHub Profile
@musicm122
musicm122 / BestOfCraigslist.xml
Created May 11, 2011 00:56
Open Data Table test YQL query
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Terrance Smith</author>
<documentationURL>http://craigslist.org/</documentationURL>
<sampleQuery>
select * from {table} where location="sfbay"
</sampleQuery>
</meta>
<bindings>
@musicm122
musicm122 / RemoveSpecialCharacters
Created September 9, 2011 12:51
Efficient Replace Special char method
public static string RemoveSpecialCharacters(string str)
{
int idx = 0;
char[] chars = new char[str.Length];
foreach (char c in str)
{
if ((c >= '0' && c <= '9')
|| (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z')
|| (c == '.') || (c == '_'))
@musicm122
musicm122 / TurnIISDebugOff.bat
Created November 28, 2011 19:35
Turn Off IIS Debugging
@echo off
:: //http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/
:: APPCMD (command) (object-type) <identifier> < /parameter1:value1 ... >*
:: start /wait notepad.exe
echo "Turn IIS Debugging Off ..."
start "Turn IIS Debugging Off" /wait C:\Windows\System32\inetsrv\APPCMD SET Config /section:asp /appAllowDebugging:False
echo "Turned Off"
start "Restarting IIS" /wait IISRESET
@musicm122
musicm122 / TurnIISDebugOn.bat
Created November 28, 2011 19:36
Turn On IIS Debugging
@echo off
:: //http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/
:: APPCMD (command) (object-type) <identifier> < /parameter1:value1 ... >*
:: start /wait notepad.exe
echo "Turn IIS Debugging On ..."
start "Turn IIS Debugging On" /wait C:\Windows\System32\inetsrv\APPCMD SET Config /section:asp /appAllowDebugging:True
echo "Turned ON"
start "Restarting IIS" /wait IISRESET
@musicm122
musicm122 / WebsCommit.bat
Created November 28, 2011 19:41
Generic bazar commit
@echo off
:: Preforms commit on Webs Directory
echo Starting Commit
echo bzr commit -m "Daily Commit for :%date%
cd C:\Webs\
bzr.exe commit -m "Daily Commit for : %date%"
pause
echo "Task Complete"
cd ..
@musicm122
musicm122 / TrigStuff.cs
Created February 7, 2012 21:36
C# Trig Functions
//Some old math stuff I wrote when in Trig class
using System;
using System.IO;
public class Geometry
{
//-----Area of a circle A= pi^2--------------------------------------------
public static double Area_Circle(double radius)
{
double area = 2*(Math.PI*(radius*radius));
@musicm122
musicm122 / gist:4612358
Last active December 11, 2015 14:09
Preforms a git checkout -- file on every file in current directory
#!/bin/bash
#Author: Terrance Smith
#musicm122.blogspot.com
#Optional Argument = n : no prompt
#currently will take a while on a large number of files
function print_files
{
for file in *
do echo $file
@musicm122
musicm122 / Diagnostic Object Extensions
Created January 23, 2013 23:21
Diagnostic Object Extensions
public static class DiagnositcObjectExtensions
{
public static string ToDiagnosticInfoString(this IEnumerable items)
{
var retval = String.Empty;
if(items.Count()>0)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine(“—–BEGIN DIAGNOSTIC——-”);
@musicm122
musicm122 / Cell_Padding_and_Cell_Spacing
Created April 1, 2013 15:27
Cell_Padding_and_Cell_Spacing in css
.UserInputTable table {
width: 100%;
border: 0;
border-spacing:0;
border-collapse:collapse;
}
.UserInputTable table td, .UserInputTable table td {
padding:5;
}
@musicm122
musicm122 / RubeLoader.cpp
Created September 25, 2013 01:35
Rube json Loader for Angel2d. adapted from SFML example code example @ https://www.iforce2d.net/rube/?panel=loaders
#include "StdAfx.h"
#include "RubeLoader.h"
#include "rubestuff/b2dJsonImage_OpenGL.h"
using namespace std;
//--Comparer
bool compareImagesByRenderOrder_ascending(const b2dJsonImage_OpenGL* a, const b2dJsonImage_OpenGL* b)
{
return a->renderOrder < b->renderOrder;