See original gist for discussion and links.
Performance Comparison: http://jsperf.com/url-parsing/5
Test Ops/sec
Regex
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| /// via original discussion http://haacked.com/archive/2009/01/14/named-formats-redux.aspx | |
| namespace Haacked.StringLib { | |
| /// <summary> | |
| /// Extension string methods for named token replacement |
| using System; | |
| using System.Collections.Generic; | |
| using System.Dynamic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using AtifAzis.Extensions; | |
| /// for http://haacked.com/archive/2009/01/14/named-formats-redux.aspx and https://gist.github.com/3763138 | |
| namespace Tests.Haacked.StringLib { |
| public class LinqSubsetTests { | |
| /// example class | |
| public class Foo { | |
| public long ID { get; set; } | |
| public int Filterable { get; set; } | |
| public string Name { get; set; } | |
| public IEnumerable<Bar> Children { get; set; } |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text.RegularExpressions; | |
| namespace Playground.Tests { | |
| public class OrderSubsetTests { | |
| #region -------------- classes ---------------- |
| // 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:'') { |
See original gist for discussion and links.
Performance Comparison: http://jsperf.com/url-parsing/5
Test Ops/sec
Regex
| <canvas id='c'></canvas> |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| namespace Ofir.Tools.Reflection | |
| { | |
| public static class AttributeExtensions | |
| { | |
| public static IEnumerable<T> GetCustomAttributes<T>(this MemberInfo memberInfo, bool inherit = false) where T : Attribute | |
| { |
| <div class="header-wrapper"> | |
| <header class="group"> | |
| <h1>Style Tile<br>Template</h1> | |
| <hgroup class="project-title"> | |
| <h2>Project name</h2> | |
| <h3>Style tile</h3> | |
| <h4>Version 1</h4> | |
| </hgroup> | |
| </header> | |
| </div> |
| var FormRepo = function (namespace) { | |
| /// <summary>Persistent form values, saves to localStorage</summary> | |
| /// <param name="namespace" type="String">the namespace to store values in localStorage</param> | |
| // should also protect per page, since we could have the same forms in various places | |
| this.N = namespace + '.' + window.location.pathname; | |
| }; | |
| $.extend(FormRepo.prototype, { | |
| namespace: function (key) { | |
| return this.N + '.' + key; |