😶🌫️
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
if (!window.console) { | |
window.onload = function() { | |
var txt = document.createElement('textarea'); | |
txt.style.position = 'absolute'; | |
txt.style.top = '0px'; | |
txt.style.left = '0px'; | |
txt.style.height = '800px'; | |
txt.style.width = '500px'; | |
txt.id = 'console'; | |
document.body.appendChild(txt); |
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
public class Foo : IEquatable<Foo> | |
{ | |
readonly int bar; | |
public Foo(int bar) | |
{ | |
this.bar = bar; | |
} | |
public override bool Equals(object obj) |
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
public class Foo : IEquatable<Foo> | |
{ | |
readonly int bar; | |
public Foo(int bar) | |
{ | |
this.bar = bar; | |
} | |
public override bool Equals(object obj) |
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 dict = new Dictionary<string, int> { | |
{ "John", 3 }, | |
{ "Mary", 4 } | |
}; | |
var flattened = dict.Select(x => | |
Enumerable.Range(0, x.Value).Select(_ => x.Key) | |
) | |
.SelectMany(x => x); |
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
//uses ClaySharp: http://clay.codeplex.com | |
//add the following usings | |
//using ClaySharp; | |
//using ClaySharp.Behaviors; | |
void Main() | |
{ | |
var foo = TypeMe<IFoo>(new { Id = 1, Name = "Aaron" }); | |
Console.WriteLine(foo.Id); | |
Console.WriteLine(foo.Name); |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Loader</title> | |
<script type="text/javascript"> | |
//assume this is in an external file, so we do an external here | |
var loader = (function() { | |
var scripts = []; | |
var ret = { |
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 loader = (function() { | |
var scripts = []; | |
var dw = function(s) { | |
document.write(s); | |
}; | |
var ret = { | |
add: function(src) { | |
if(!scripts.indexOf(src)) { | |
scripts.push(src); | |
} |
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
(function($) { | |
$.fn.blinky = function(args) { | |
var opts = { frequency: 1e3, count: -1 }; | |
args = $.extend(true, opts, args); | |
var i = 0; | |
var that = this; | |
var dfd = $.Deferred(); | |
function go() { | |
if(that.length == 0) { | |
return dfd.reject(); |
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
(function($) { | |
$.fn.textWidth = function(){ | |
var calc = '<span style="display:none">' + $(this).text() + '</span>'; | |
$('body').append(calc); | |
var width = $('body').find('span:last').width(); | |
$('body').find('span:last').remove(); | |
return width; | |
}; | |
$.fn.marquee = function(args) { |
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 s = "asd"; | |
switch(true) { | |
case true: | |
if(s == "dsa") { | |
goto case false; | |
} | |
s = "dsa"; | |
goto case true; | |
OlderNewer