Skip to content

Instantly share code, notes, and snippets.

@kdarty
kdarty / Find-Column-in-all-Tables.sql
Created December 31, 2015 14:25
Ever need to find what Tables have reference to a certain Column? This SQL Script will query the System Tables to find all references to a given Column Name. A GUI like SSMS would be helpful but it is nice to have an easy script to produce such a report. Source: http://blog.sqlauthority.com/2008/08/06/sql-server-query-to-find-column-from-all-tab…
USE [DatabaseName]
GO
-- Searcj all Tables for a given Column Name
-- Refine WHERE Clause to suit your needs
SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
@kdarty
kdarty / index.html
Created January 27, 2016 15:13 — forked from alexandrevicenzi/index.html
Bootstrap CSS Animate Loading Icon Button
<!-- Code snippet -->
<div class="form-group">
<div class="col-md-12 text-center">
<span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span>
</div>
</div>
@kdarty
kdarty / circle-border.css
Created April 29, 2016 18:05
Make an Image Round with a Border and Shadow.
/* Source: http://stackoverflow.com/questions/16310985/add-border-to-circle-image */
img.circle-border {
width: 126px;
height: 126px;
border: 5px solid #fff;
border-radius: 150px;
-webkit-border-radius: 150px;
-moz-border-radius: 150px;
box-shadow: 0 0 8px rgba(0, 0, 0, .8);
-webkit-box-shadow: 0 0 8px rgba(0, 0, 0, .8);
@kdarty
kdarty / YearRangeDropDownList.cs
Created June 9, 2016 18:09
For those times when you need to create a DropDownList for a range of Years, you can easily do that through "Enumerable.Range". The sample code below will create a list that ranges from 1900 to the next most Current Year and then Sort that list in Descending Order.
// NOTE: This requires a USING clause for System.Web.Mvc
var selectListItems = new List<SelectListItem>();
// Add Default Selection
selectListItems.Add(new SelectListItem
{
Text = "-- Make a Selection --",
Value = "0",
Selected = true
});
input {
text-transform: uppercase;
}
::-webkit-input-placeholder { /* WebKit browsers */
text-transform: none;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
text-transform: none;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
@kdarty
kdarty / Maxlength-Numeric-Limiter.js
Last active September 15, 2016 16:02
While Input Type TEXT can easily be limited to input based on the Maxlength, Input Type NUMBER does not. To fix this shortcoming and keep the user-friendly experience of moving to a Numeric Keyboard on Mobile, trap the "KeyUp" Event and slice input text based on the given Maxlength of the field.
// On Key Up Event Handler to ensure Numeric Inputs adhere to their Max Length
$('input[type=number]').on('keyup', function (event) {
var maxlength = $(this).attr('maxlength');
if (this.value.length > maxlength) {
this.value = this.value.slice(0, maxlength);
}
});
@kdarty
kdarty / Disable-Back-Button.js
Last active September 15, 2016 16:03
Prevent Users from using the BACK Button. To do this we must actually put a tiny piece of JavaScript on the Page we do not want users to go back to. In other words, once they leave the page, if they attempt to return they will be forced back to the page they left.
/* [Begin] Prevent User from Returning to this Page after Submit */
function disableBack() {
window.history.forward()
}
window.onload = disableBack();
window.onpageshow = function (event) { if (event.persisted) disableBack() }
/* [End] Prevent User from Returning to this Page after Submit */
@kdarty
kdarty / bootstrap-modal-onload-example.js
Created September 13, 2016 15:51
Here's a good example of how to run code as a Bootstrap Modal Loads. This is good for when you are remotely loading content into a Bootstrap Modal and want to execute some code against the newly loaded DOM. Simply add a callback function to your jQuery 'load' method that will fire once the content is loaded.
// Source Discussion: https://github.com/twbs/bootstrap/issues/5169
$('#do-modal').click(function(e) {
e.stopPropagation();
$('#foo .modal-body').load(this.href, function(response, status, xhr) {
/* do something cool */
$('#foo').modal();
});
});
@kdarty
kdarty / Web.xml
Created September 23, 2016 12:09
Define Web Font Mime Types within the Web.config of an ASP.NET Project to ensure that the Web Server properly handles serving up your Fonts.
<system.webServer>
<staticContent>
<!-- Remove any potential Web Server Settings for Web Fonts to be used -->
<remove fileExtension=".eot" />
<remove fileExtension=".otf" />
<remove fileExtension=".ttf" />
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<!-- Define Web Font Mime Types that will be used -->
@kdarty
kdarty / carousel-with-overlay.css
Created September 23, 2016 18:24
This sample code came from Bootsnipp. It provides a sample for how to provide an overlay for Bootstrap Carousel slide images: Bootstrap Carousel with Overlay (Text) http://bootsnipp.com/snippets/6n3Wr