Skip to content

Instantly share code, notes, and snippets.

@zaus
zaus / gist:71a7a89bc3bec0d8ea2faaa287c20c82
Last active September 22, 2016 16:26 — forked from marksteve/gist:877210
Monokai Notepad2 Color Scheme /mod
[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
@zaus
zaus / parse-hash-bang-arguments-in-javascript.js
Last active December 15, 2015 04:29 — forked from miohtama/parse-hash-bang-arguments-in-javascript.js
Parse "hashbang" `#!` arguments like url query-string. [original source](https://gist.github.com/miohtama/1570295)
/**
* 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) {
@zaus
zaus / OtherRAFShims.js
Last active December 14, 2015 13:19 — forked from mrdoob/RequestAnimationFrame.js
Exploring simpler `requestAnimationFrame` shims
// 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');
@zaus
zaus / jquery.tinierpubsub.js
Last active December 12, 2015 10:08 — forked from cowboy/HEY-YOU.md
/* 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
@zaus
zaus / jsperf-results.md
Created October 24, 2012 21:25 — forked from jlong/uri.js
URI Parsing with Javascript - regex version

See original gist for discussion and links.

Performance Comparison: http://jsperf.com/url-parsing/5

Testing in Chrome 22.0.1229.94 32-bit on Windows Server 2008 R2 / 7 64-bit

Test Ops/sec

Regex

@zaus
zaus / _vendorize.scss
Last active October 11, 2015 23:58 — forked from heroheman/gist:3907611
SASS: Vendorize Mixin with editable vendors
// 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:'') {
@zaus
zaus / SublevelFilterTest_Order.cs
Created October 19, 2012 13:32 — forked from zaus/SublevelFilterTest.cs
C# Linq Sublevel Filtering - Only return 1st-level with matching 2nd-level items, but resultset only contains matching 2nd-level items; more "practical" example with Order/LineItem relationship
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Playground.Tests {
public class OrderSubsetTests {
#region -------------- classes ----------------
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;