See original gist for discussion and links.
Performance Comparison: http://jsperf.com/url-parsing/5
Test Ops/sec
Regex
| [Default Text] | |
| FileNameExtensions=txt; text; wtx; log; asc; doc | |
| Default Style=font:DejaVu Sans Mono; size:10; fore:#F8F8F2; back:#000000 | |
| Margins and Line Numbers=size:-2; fore:#BCBCBC; back:#3B3A32 | |
| Matching Braces=size:+1; bold; fore:#000000; back:#FD971F | |
| Matching Braces Error=size:+1; bold; fore:#F8F8F0; back:#F92672 | |
| Control Characters (Font)=size:-1 | |
| Indentation Guide (Color)=fore:#A0A0A0 | |
| Selected Text (Colors)=fore:#F8F8F2; back:#49483E; eolfilled | |
| Whitespace (Colors, Size 0-5)=fore:#AA2B00 |
| using System.IO; | |
| // modified from RestSharp unit tests https://github.com/restsharp/RestSharp/blob/master/RestSharp.IntegrationTests/Helpers/SimpleServer.cs | |
| namespace UnitTesting | |
| { | |
| using System; | |
| using System.Net; | |
| using System.Security; | |
| using System.Threading; |
| /** | |
| * Parse hash bang parameters from a URL as key value object. | |
| * For repeated parameters the last parameter is effective. | |
| * If = syntax is not used the value is set to null. | |
| * #!x&y=3 -> { x:null, y:3 } | |
| * @param url URL to parse or null if window.location is used | |
| * @return Object of key -> value mappings. | |
| * @source https://gist.github.com/zaus/5201739 | |
| */ | |
| function hashbang(url, i, hash) { |
| // simplest, "original": 234 char | |
| !window.requestAnimationFrame && (window.requestAnimationFrame = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60) }); | |
| // compressible simplest: 157 char | |
| (function(w,anif) { | |
| if(!w['r' + anif]) w['r' + anif] = w['webkitR' + anif] || w['mozR' + anif] || w['msR' + anif] || w['oR' + anif] || function (callback) { w.setTimeout(callback, 1000 / 60) }; | |
| })(window, 'equestAnimationFrame'); | |
| /* jQuery Tinier Pub/Sub - v0.9 - 2013-02-11 | |
| * original by http://benalman.com/ 10/27/2011 | |
| * Original Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */ | |
| (function($) { | |
| // "topic" holder | |
| var o = $({}); // use $('<b>') with Zepto, as it doesn't like {} ? | |
| // attach each alias method |
See original gist for discussion and links.
Performance Comparison: http://jsperf.com/url-parsing/5
Test Ops/sec
Regex
| // edit for whichever you care about | |
| $vendors: 'webkit', 'moz', 'ms'; // 'webkit', 'moz', 'ms', 'o', 'khtml'; | |
| /// @summary Repeat for multiple vendor prefixes, like prefix-free processor | |
| /// @param $property the property to repeat | |
| /// @param $noplain set 'true' to disable prefixless option | |
| /// @param $vendors override the global vendor list | |
| /// @param $prefix optional additional prefix; supposed to allow keyframe specification with `@` | |
| /// | |
| /// @see http://css-tricks.com/redesigning-with-sass/ for references | |
| @mixin vendorize($property, $value, $noplain: false, $vendors: $vendors, $prefix:'') { |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text.RegularExpressions; | |
| namespace Playground.Tests { | |
| public class OrderSubsetTests { | |
| #region -------------- classes ---------------- |