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
// Working example: http://www.jsfiddle.net/mUrVB/22/ | |
(function($) { | |
$.fn.selection = function() { | |
var start = this[0].selectionStart, | |
end = this[0].selectionEnd; | |
if (start === end) { | |
return null; |
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 xmlns:pretty="http://prettycode.org/xmlns/json2xml"> | |
<head> | |
<title>Proof of Concept</title> | |
<script> | |
var XML = { | |
defaultNamespace: undefined, | |
stringify: function(ns, value, name) { | |
if (typeof ns === 'undefined') { | |
ns = this.defaultNamespace; |
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>Proof of Concept</title> | |
<script> | |
// TODO how should Arrays be handled? | |
// TODO strict mode (no '\n' or padding) to allow for significant whitespace (e.g. for <pre>, <textarea>) | |
var toHTML = function(value, name, indent) { | |
var pad = new Array((indent = indent || 0)).join(' '); | |
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 submitForm = function(config) { | |
if (!config) { | |
throw new Error(); | |
} | |
else { | |
config.method = config.method || 'post'; | |
config.data = config.data || {}; | |
config.url = config.url || (function() { | |
throw new Error('Missing required `url` argument'); |
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 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) { |
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 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 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 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 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 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; |
OlderNewer