Skip to content

Instantly share code, notes, and snippets.

View brazilnut2000's full-sized avatar

Jon Crowell brazilnut2000

View GitHub Profile
/*
This is really interesting, I had no idea.
http://shapeshed.com/html5-speech-recognition-api/
HTML5 includes built in speech recognition, which is stupid easy to use:
Open your console and enter:
*/
@brazilnut2000
brazilnut2000 / Find string if it exists in any table in a database
Last active August 29, 2015 14:04
SQL:FindStringAnywhereInDatabase
/*
Find string if it exists in any table in a database
Source: http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/the-ten-most-asked-sql-server-questions--1/#2
Found via: http://stackoverflow.com/a/9185923/138938
*/
CREATE PROCEDURE FindMyData_String
@DataToFind NVARCHAR(4000),
@ExactMatch BIT = 0
@brazilnut2000
brazilnut2000 / gitignore template.txt
Last active March 25, 2025 04:31
GIT: gitignore template for c# development
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
###################
# compiled source #
###################
*.com
*.class
*.dll
*.exe
@brazilnut2000
brazilnut2000 / IsStringNumeric.cs
Last active January 2, 2016 00:29
C#: Determine whether a string is numeric
public static bool isNumeric(string val, System.Globalization.NumberStyles NumberStyle)
{
Double result;
return Double.TryParse(val, NumberStyle,
System.Globalization.CultureInfo.CurrentCulture, out result);
}
/*
USAGE:
@brazilnut2000
brazilnut2000 / Generic HTML5 Page
Last active December 28, 2015 11:09
EMMET: Script to generate generic semantic html5 page
<!DOCTYPE html>
html>head>title+link^body>(header.top>a.logo>img)+nav.primary>a{Link$}*3^(div.main>(aside.sidebar>nav>a{Sublink$}*3)+section.content>article>header>h1+p>lipsum)+footer.bottom>nav>a{social$}*3
@brazilnut2000
brazilnut2000 / Find Column From All Tables of Database.sql
Created September 25, 2013 19:40
SQL: Find column from all tables of database
/*
Replace COLUMNNAME with the column you are looking for...
Source: Pinal Dave
*/
SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
@brazilnut2000
brazilnut2000 / GeolocationFromLatLon.sql
Created August 23, 2013 21:27
SQL: Populate GeoLocation table from Latitude and Longitude
/*
Assumes table has populated Latitude and Longitude columns
Populates the GeoLocation column from Lat ad Lon
*/
UPDATE [dbo].[TableX]
SET [GeoLocation] = geography::Parse('POINT(' + CAST([Longitude] AS VARCHAR(20)) + ' ' +
CAST([Latitude] AS VARCHAR(20)) + ')')
GO
@brazilnut2000
brazilnut2000 / Get Pluralized Word.cs
Created July 26, 2013 19:17
C#: Return the singular or plural version of a word based on how many there are
static string GetPluralized(string word, int count)
{
return count == 1 ? word : word + "s";
}
@brazilnut2000
brazilnut2000 / RemoveInvalidCharacters.bas
Created July 11, 2013 05:06
VBA: Remove list of characters from a string using Regex
Function RemoveInvalidCharacters(cleanMe As String) As String
Dim objRegex As Object
Set objRegex = CreateObject("vbscript.regexp")
With objRegex
.Global = True
.Pattern = "[\<\>\*\'\,\$\#\@\.\""\?\!\/\[\]\:\|\\\/\?|]"
RemoveInvalidCharacters = .Replace(cleanMe, "")
End With
End Function