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
<!doctype html> | |
<html> | |
<head> | |
<title></title> | |
<style> | |
body { | |
width: 100%; | |
padding: 0; | |
margin: 0; | |
background-color: #F0F0F0; |
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
using System; | |
using System.IO; | |
using System.Net.Sockets; | |
namespace prettycode.org | |
{ | |
// Author: Chris O'Brien, prettycode.org | |
public static class NetworkStreamExtensions | |
{ |
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
var actionCount = typeof(/*Some Controller Type In Your MVC App*/) | |
.Assembly.GetTypes() | |
.Where(t => typeof(Controller).IsAssignableFrom(t)) | |
.Where(t => t.Namespace.StartsWith("AwesomeProduct.Web")) | |
.SelectMany(t => t.GetMethods(BindingFlags.Public | BindingFlags.Instance)) | |
.Where(m => typeof(ActionResult).IsAssignableFrom(m.ReturnType)) | |
.Where(m => !m.IsAbstract) | |
.Where(m => m.GetCustomAttribute<NonActionAttribute>() == null) | |
.Count(); |
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 Analytics(config) { | |
config = config || {}; | |
var ga = (_gaq || []), | |
accountKey, | |
domainName, | |
proto = (this.prototype = Object.prototype); | |
proto.accountKey = function() { | |
if (!arguments.length) { |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Diagnostics; | |
using System.Threading; | |
using System.Security.Cryptography; | |
using System.Xml.Linq; | |
using System.Security; |
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
// 1 | |
(function(undefined) { | |
"use strict"; | |
var Notifications = Windows.UI.Notifications; | |
var Xml = Windows.Data.Xml; | |
var ToastController = { | |
configToXML: function(config) { | |
config.version = config.version || "1"; |
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
// Cryptographically-strong random number generator | |
// Source: MSDN Magazine > 2007 > September > .NET Matters: Tales from the CryptoRandom | |
// Source URL: http://msdn.microsoft.com/en-us/magazine/cc163367.aspx | |
// Authors: Stephen Toub & Shawn Farkas | |
public class CryptoRandom : Random | |
{ | |
private RNGCryptoServiceProvider cryptoProvider = new RNGCryptoServiceProvider(); | |
private byte[] uint32Buffer = new byte[4]; |
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
// jQuery shim for supporting <textarea> `maxlength` attribute in IE < 10 | |
// Author: Chris O'Brien, prettycode.org | |
// License: MIT | |
(function ($) { | |
// Target only IE browsers that don't support `maxlength` | |
if (typeof document.selection === 'undefined' || | |
'maxLength' in document.createElement('textarea') |
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 forkGist(user, gist) { | |
var path = (arguments.length ? ('/' + user + '/' + gist) : location.pathname); | |
var form = document.createElement('form'); | |
form.method = 'post'; | |
form.action = 'https://gist.github.com' + path + '/fork', | |
form.submit(); | |
} | |
// Paste into browser console when viewing a Gist (including your own) to fork it | |
forkGist(); |
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
var example = { | |
//js: 'https://gist.github.com/prettycode/5401842/raw/example.js' | |
js: 'http://fiddle.jshell.net/js/heyoffline.js?StillNoSpring' | |
} | |
loadScript(example.js, { | |
document: { | |
createElement: function(tag) { | |
return { | |
setAttribute: function(key, value) { |