Skip to content

Instantly share code, notes, and snippets.

View mwurzberger's full-sized avatar

Matthew Wurzberger mwurzberger

View GitHub Profile
@mwurzberger
mwurzberger / codepoints.js
Created August 23, 2016 17:24
Converting strings between code points ES6
function stringToCodePointsArray(inStr) {
var outArr = [];
for (const symbol of inStr) {
var point = symbol.codePointAt(0);
outArr.push(point);
// if (point !== 2028 && point !== 2029) {
// outArr.push(point);
// }
}
return outArr;
<html>
<head>
<title>REST + jQuery Example</title>
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
<script type="text/javascript">
// Requires jquery 3.1.0
// Good resource for jQuery REST http://www.lm-tech.it/Blog/post/2013/05/08/How-to-consume-a-RESTful-service-using-jQuery.aspx
/**
* updates a form dropdown
@mwurzberger
mwurzberger / nestedObjectIter.js
Last active August 10, 2016 18:22
nested object iteration
function stripCartId(mainObj) {
function nestedSearch(obj) {
Object.keys(obj).forEach(function (key) {
if (key === 'cart') {
delete obj[key].id;
}
if (typeof obj[key] === 'object') {
return nestedSearch(obj[key]);
}
});
@mwurzberger
mwurzberger / custom-error.js
Last active March 23, 2016 13:51 — forked from justmoon/custom-error.js
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
var original = myObj.funcName;
sinon.stub(myObj, 'funcName', function () {
console.log('stub for funcName');
original.apply(myObj, arguments);
});
function roundToDecimal(val, decimals) {
return Number(Math.round(val+'e'+decimals)+'e-'+decimals);
}
var len = arguments.length;
for (var i = 1; i < len; i++) {
arguments[i];
}
@mwurzberger
mwurzberger / sublime_text3_osx.md
Last active March 6, 2018 16:33
Sublime Text 3 Setup on OSX
@mwurzberger
mwurzberger / url-params.js
Last active August 29, 2015 14:22
JavasScript URL Param Manipulation
// Based on results at http://jsperf.com/url-param-manipulation
// setURLParam returns a new queryString but not an entire URL
testURL: 'https://www.test.com?i=main&mode=front&sid=de8d49b78a85a322c4155015fdce22c4&enc=+Hello%20&empty&zpac=gooberface234324&a=3&b=4&c=5&d=11&e=15',
setURLParam: function( paramName, paramValue, urlString ) {
setURLParam: function( paramName, paramValue, urlString ) {
var urlParams = this.getURLParams( urlString ),
newParams = [],
foundParam = false;
@mwurzberger
mwurzberger / gist:7b1987488e69cc621407
Created May 4, 2015 13:41 — forked from askehansen/gist:11253752
Parsley 2.x config for twitter bootstrap 3.x
window.ParsleyConfig = {
errorClass: 'has-error',
successClass: 'has-success',
classHandler: function (ParsleyField) {
return ParsleyField.$element.parents('.form-group');
},
errorsContainer: function (ParsleyField) {
return ParsleyField.$element.parents('.form-group');
},
errorsWrapper: '<span class="help-block">',

Sublime Text 3 - Monokai Extended Sidebar Theme

A theme for the sidebar in Sublime Text 3 to match the workspace of the Monokai Extended theme.

This theme only modifies the sidebar to better match the Monokai Extended theme, without modifying any of the styling elsewhere defined by Monokai Extended.

File location: SublimeText_ROOT\Data\Packages\User

For the Monkai Extended Theme, visit https://github.com/jonschlinkert/sublime-monokai-extended