This file contains 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
window.Em = window.Em || {}; | |
Em = { | |
setFocusOutValidation: function (form) { | |
var s = $.data(form, "validator").settings; | |
s.onfocusout = function (element) { | |
if ($(element).val().length > 0) { | |
$(element).valid(); | |
} | |
}; |
This file contains 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
///<remarks> | |
/// Turns out this wasn't needed - and far less elegant than the existing extension method. | |
/// However, it is still an example of a generic way to match a given property with a value | |
/// and how to select that property by name (string) and compare its value to the value | |
/// that is passed in. It works... | |
///</remarks> | |
public static IList<T> ApplyFilter<T>(this IList<T> list, FilterDescriptor filter) { | |
// We wont allow filtering on anything but string type properties | |
if (filter.MemberType != typeof(string)) throw new ArgumentException("Filtering is only allowed for properties with a type of 'string'."); |
This file contains 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
var d = $("input[data-toggle-class]"); | |
$.each(d, function (idx, data) { | |
console.log(idx, data); | |
}); |
This file contains 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
javascript: (function () { | |
var trolls = [ | |
'troll', // <-- add troll names here | |
]; | |
var el = document.createElement('div'), | |
b = document.getElementsByTagName('body')[0]; | |
otherlib = false, msg = ''; | |
el.style.position = 'fixed'; | |
el.style.height = '32px'; |
This file contains 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> | |
/// Reads database schema from query, generates assembly in the memory, and returns dynamic object | |
/// </summary> | |
public static System.Collections.IEnumerable DynamicSqlQuery(this Database database, string sql, params object[] parameters) | |
{ | |
TypeBuilder builder = DynamicMapper.createTypeBuilder( | |
"MyDynamicAssembly", "MyDynamicModule", "MyDynamicType"); | |
using (System.Data.IDbCommand command = database.Connection.CreateCommand()) | |
{ |
This file contains 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
private IList<T> ConvertCsvToList<T>(IList<string> csv, string[] header) { | |
var list = new List<T>(); | |
foreach (var row in csv) { | |
var columns = row.Split(','); | |
T obj = (T)Activator.CreateInstance(typeof(T)); | |
for (int i = 0; i < columns.Length; i++) { | |
var h = Regex.Match(header[i].Replace("@", "_"), @"(?<="")(?:\\.|[^""\\])*(?="")").Value; | |
var c = Regex.Match(columns[i], @"(?<="")(?:\\.|[^""\\])*(?="")").Value; | |
var prop = typeof(Em.Schools.Data.Domain.Match).GetProperty(h); |
This file contains 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
namespace MySweetApp | |
{ | |
using System; | |
using System.Linq.Expressions; | |
using System.Text; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Web.Mvc.Html; | |
public static class FormHelpers |
This file contains 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
cinst fiddler4 | |
cinst console-devel | |
cinst sublimetext2 | |
cinst googlechrome | |
cinst windirstat | |
cinst sysinternals | |
cinst 7zip | |
cinst winmerge | |
cinst firefox | |
cinst nodejs |
This file contains 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
/* Examples: | |
* var test = "test {0} {1}, {2} - {0} {1} {2}".format('a', 'b', 'c'); | |
* var test2 = "the {0} ate the {1}".format("cat", "canary"); | |
*/ | |
String.prototype.format = function () { | |
var self = this; | |
var re = /\{\d+\}/g; | |
var m = self.match(re); | |
var indexes = []; | |
This file contains 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
# delete local tag '12345' | |
git tag -d 12345 | |
# delete remote tag '12345' (eg, GitHub version too) | |
git push origin :refs/tags/12345 | |
# alternative approach | |
git push --delete origin tagName | |
git tag -d tagName |