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
[].concat( | |
Object.getOwnPropertyNames(Object), | |
Object.getOwnPropertyNames(window) | |
).map(function(x){return {name:x,length:JSFuck.encode(x).length};}) | |
.sort(function(x,y) {return x.length-y.length;}) | |
.forEach(function(x) {console.log(x);}) |
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 class EnumerableEx | |
{ | |
public static bool Any(this IEnumerable e) | |
{ | |
using (var i = enumerable.GetEnumerator()) | |
{ | |
return i.MoveNext(); | |
} | |
} |
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
def using (v, &block) | |
begin | |
block.call | |
ensure | |
v.close unless v.nil? if v.class.method_defined? :close | |
end | |
end | |
class Resource | |
def name () |
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
if (!document.getElementsByClassName) { | |
document.getElementsByClassName = function(search) { | |
var d = document, elements, pattern, i, results = []; | |
if (d.querySelectorAll) { // IE8 | |
return d.querySelectorAll("." + search.replace(/\s+/g, '.')); | |
} | |
if (d.evaluate) { // IE6, IE7 | |
pattern = ".//*[contains(concat(' ', @class, ' '), ' " + search + " ')]"; | |
elements = d.evaluate(pattern, d, null, 0, null); | |
while ((i = elements.iterateNext())) { |
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
String.prototype.visualLength = (function() { | |
var that = this, | |
ruler = document.getElementById('ruler'); | |
if (!ruler) { | |
ruler = document.createElement('span'); | |
document.body.appendChild(ruler); | |
} | |
ruler.style.visibility = 'hidden'; | |
return function () { | |
ruler.innerHTML = that; |
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
/* http://meyerweb.com/eric/tools/css/reset/ | |
v2.0 | 20110126 | |
License: none (public domain) | |
*/ | |
html, body, div, span, applet, object, iframe, | |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
a, abbr, acronym, address, big, cite, code, | |
del, dfn, em, img, ins, kbd, q, s, samp, | |
small, strike, strong, sub, sup, tt, var, |
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 class NullableTypeEx | |
{ | |
public static Type UnwrapIfNullable(this Type type) | |
{ | |
return type.IsNullable() ? type.GetGenericArguments()[0] : type; | |
} | |
public static bool IsNullable(this Type type) | |
{ | |
return type.IsGenericType && type.GetGenericTypeDefinition() == typeof (Nullable<>); |
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 interface IStatefulComponent | |
{ | |
StateBag ViewState { get; } | |
} | |
public class ViewStateField | |
{ | |
public static ViewStateField<T> Create<T>(StateBag viewState, string key) | |
{ | |
return new ViewStateField<T>(() => viewState, key); |
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
// System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | |
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | |
// System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | |
// System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | |
// System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | |
// System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | |
// System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | |
// System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | |
// Iesi.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 | |
// System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 |
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 class StringExtensions | |
{ | |
public static bool Contains(this string self, string value, StringComparison comparisonType) | |
{ | |
return self.IndexOf(value, comparisonType) != -1; | |
} | |
} |