Skip to content

Instantly share code, notes, and snippets.

Ernest Mallett DCCoder90

Block or report user

Report or block DCCoder90

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DCCoder90
DCCoder90 / Startup.cs
Created Sep 19, 2018
For micro-api tutorial
View Startup.cs
using System.Web.Http;
using Owin;
namespace SelfHosted{
public class Startup{
public void Configuration(IAppBuilder app){
// Configure Web API for self-host.
var config = new HttpConfiguration();
config.Routes.MapHttpRoute(
name: "DefaultApi",
@DCCoder90
DCCoder90 / truncate.sql
Created Aug 27, 2018
Truncate tables with respect to FKs
View truncate.sql
SET NOCOUNT ON
GO
DECLARE @table TABLE(
RowId INT PRIMARY KEY IDENTITY(1, 1),
ForeignKeyConstraintName NVARCHAR(200),
ForeignKeyConstraintTableSchema NVARCHAR(200),
ForeignKeyConstraintTableName NVARCHAR(200),
ForeignKeyConstraintColumnName NVARCHAR(200),
PrimaryKeyConstraintName NVARCHAR(200),
@DCCoder90
DCCoder90 / columnSearch.sql
Created Aug 27, 2018
Query that searches system tables to identify a table that has a specified column name
View columnSearch.sql
SELECT c.name AS 'ColumnName'
,t.name AS 'TableName'
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%COLUMN NAME%'
ORDER BY TableName
,ColumnName;
@DCCoder90
DCCoder90 / detectBlocking.sql
Created Aug 27, 2018
Query to detect any blocking queries
View detectBlocking.sql
SELECT blocked_query.session_id AS blocked_session_id,
blocking_query.session_id AS blocking_session_id,
sql_text.text AS blocked_text,
sql_btext.text AS blocking_text,
waits.wait_type AS blocking_resource
@DCCoder90
DCCoder90 / getFullyQualifiedName.sql
Created Aug 20, 2018
Get fully qualified object name from object id
View getFullyQualifiedName.sql
create function dbo.getFullyQualifiedName(
@objectid int
) returns sysname
begin
declare @fqn sysname
select
@fqn = CONCAT(
QUOTENAME(@@SERVERNAME), '.',
QUOTENAME(DB_NAME()), '.',
@DCCoder90
DCCoder90 / NightmareJSInfiniteScroll.js
Created Mar 25, 2018
Scroll to the bottom of an infinite scroll page with NightmareJS
View NightmareJSInfiniteScroll.js
var previousHeight, currentHeight=0;
while(previousHeight !== currentHeight) {
previousHeight = currentHeight;
var currentHeight = yield nightmare.evaluate(function() {
return document.body.scrollHeight;
});
yield nightmare.scrollTo(currentHeight, 0)
.wait(3000);
}
@DCCoder90
DCCoder90 / AddressPOCO.cs
Created Feb 26, 2018
A quick and dirty address validator using Google's Geocoding API. Could be easily expanded upon.
View AddressPOCO.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Validation
{
public class AddressComponent {
public string long_name { get; set; }
public string short_name { get; set; }
public List<string> types { get; set; }
@DCCoder90
DCCoder90 / Extensions.cs
Created Jan 18, 2018
A few extension methods for rounding
View Extensions.cs
public static class Extensions{
/**
* Rounds the supplied number to the nearest multiple of the parameter
* @param this int The number to round
* @param int The multiple to use
* @return int
* @static
* @extension
*/
@DCCoder90
DCCoder90 / TerrainMath.cs
Created Jan 18, 2018
A collection of helpers for Terrain math with Unity
View TerrainMath.cs
public static class TerrainMath{
/**
* Gets the XBase and width based on bounds input
* @param portalBounds The bounds of the Box collider to use
* @param terrainBounds The bounds of the terrain collider to use
* @return Vector2 Where X is the XBase and Y is the Width
* @static
*/
public static Vector2 GetXBaseAndWidth(Bounds portalBounds, Bounds terrainBounds){
@DCCoder90
DCCoder90 / mysqlBackup.sh
Created Jan 12, 2018
Bash script to backup all databases
View mysqlBackup.sh
#!/bin/bash
mysqldump -u root -p[PASSWORD] --all-databases | gzip > /PATH/TO/STORE/BACKUP/mysqldb_`date +%F`.sql.gz
You can’t perform that action at this time.