This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
textarea, textarea:focus { | |
width:100%; | |
height:100%; | |
margin: 0; | |
border:0; | |
border-color:transparent; | |
outline:none; | |
overflow-y:auto; | |
resize:none; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.prototype.extend = function(obj){ | |
if(typeof obj !== 'object') return this; | |
var current, prop, | |
i = 0, | |
length = arguments.length; | |
for(; i<length; i++){ | |
current = arguments[i]; | |
if(typeof current === 'object'){ | |
for(prop in current){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pure CSS | |
.element { | |
position: relative; | |
top: 50%; | |
transform: translateY(-50%); | |
} | |
// Less Mixin | |
.vertical-align { | |
position: relative; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function console_table(xs) { | |
function pad(n, s) { | |
var res = s; | |
for (var i = s.length; i < n; i++) | |
res += " "; | |
return res; | |
} | |
if (xs.length === 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function pollForUpdate(){ | |
setTimeout(function(){ | |
$.post('/some/url/', function(data){ | |
//process data | |
pollForUpdated(); | |
}); | |
}, 5000); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string TrimTrailingComma(string value) | |
{ | |
if (value.Length >= 2) | |
{ | |
if(value[value.Length-1].Equals(" ") && value[value.Length-2].Equals(",")) | |
{ | |
value = value.Substring(0, value.Length - 2); | |
} | |
else if (value[value.Length - 1].Equals(",")) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ratings.Sort((x, y) => x.Grade.CompareTo(y.Grade)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Adds an item to the list only if it doesn't already exist there. | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
/// <param name="coll"></param> | |
/// <param name="item"></param> | |
public static void AddIfNotExists<T>(this ICollection<T> coll, T item) { | |
if (!coll.Contains(item)) | |
{ | |
coll.Add(item); |
NewerOlder