Skip to content

Instantly share code, notes, and snippets.

Marius Schulz mariusschulz

Block or report user

Report or block mariusschulz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View main.bundle.js
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
@mariusschulz
mariusschulz / lesson-1-global-context.js
Last active Nov 29, 2017
Code for my egghead.io course "Understand JavaScript's this Keyword in Depth"
View lesson-1-global-context.js
// "use strict";
console.log(this === window);
View arrow-functions.js
const square = function(x) {
return x * x;
};
const cube = (x) => {
return x * x * x;
};
const numbers = [11, 20, 33, 40, 55];
@mariusschulz
mariusschulz / list.md
Last active Jun 25, 2016
ECMAScript 2015 Resources
@mariusschulz
mariusschulz / deserialization.js
Last active Apr 19, 2018
Automatic JSON date deserialization
View deserialization.js
const DATE_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+$/;
function deserializeProperty(key, value) {
return typeof value === "string" && DATE_PATTERN.test(value)
? new Date(value)
: value;
}
const obj = JSON.parse('{ "date": "2016-04-26T18:09:16.61" }', deserializeProperty);
console.log(typeof obj.date);
@mariusschulz
mariusschulz / .eslintrc
Created Nov 7, 2015
My ESLint configuration
View .eslintrc
{
"env": {
"es6": true,
"browser": true,
"node": true
},
"ecmaFeatures": {
"modules": true
},
"rules": {
@mariusschulz
mariusschulz / HtmlHelperExtensions.cs
Last active Mar 13, 2018
Two C# extension methods for inlining script and style bundles into the HTML response using ASP.NET MVC and the System.Web.Optimization framework.
View HtmlHelperExtensions.cs
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
public static class HtmlHelperExtensions
{
public static IHtmlString InlineScripts(this HtmlHelper htmlHelper, string bundleVirtualPath)
{
return htmlHelper.InlineBundle(bundleVirtualPath, htmlTagName: "script");
@mariusschulz
mariusschulz / Digits.cs
Last active Nov 4, 2015
A list of characters that the regular expression pattern \d matches in .NET.
View Digits.cs
var digitRegex = new Regex(@"\d");
IEnumerable<char> digitCharacters = Enumerable
.Range(1, Char.MaxValue)
.Select(Convert.ToChar)
.Where(c => digitRegex.IsMatch(c.ToString()));
View IndentedTextWriterDemo.cs
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace IndentedTextWriterDemo
{
public class TodoItem
{
@mariusschulz
mariusschulz / trimStart.js
Created Oct 11, 2014
A JavaScript trimStart function
View trimStart.js
function trimStart(character, string) {
var startIndex = 0;
while (string[startIndex] === character) {
startIndex++;
}
return string.substr(startIndex);
}
You can’t perform that action at this time.