Skip to content

Instantly share code, notes, and snippets.

View marlun78's full-sized avatar

Martin Eneqvist marlun78

View GitHub Profile
@marlun78
marlun78 / format-date.js
Last active March 3, 2023 08:09
A JavaScript date format inspired by the .NET framework
/**
* Date Format
* Copyright (c) 2011, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* Format options inspired by the .NET framework's format.
* http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
*
* Non-formatting characters within the format string must be
* quoted (single (') or double (") quotes)! The same is true
@marlun78
marlun78 / JavaScriptTimeConverter.cs
Last active January 28, 2023 03:57
C# to/from JavaScript date converter
/**
* C# <> JavaScript Date Converter
* Copyright (c) 2011 marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*/
/// <summary>
/// Provides a Convert method to convert between C# DateTime values and JavaScript parsable Int64 date values.
/// </summary>
public static class JavaScriptDateConverter
{
@marlun78
marlun78 / Garkbit.StringExtensions.cs
Last active September 27, 2015 21:38
C# StringExtensions Class
/**
* C# String Extensions
* Copyright (c) 2011 marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*/
using System;
using System.Collections.Generic;
namespace Garkbit {
public static class StringExtensions {
@marlun78
marlun78 / unsorted.js
Last active September 27, 2015 20:58
Unsorted JavaScript stuff
/**
* Unsorted stuff
* Copyright (c) 2011, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*/
(function (NS) {
if (!NS) { NS = window; }
// isNumber
/**
* Mootools Date.Swedish.js
* Copyright (c) 2009, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*/
MooTools.lang.set('sv-SE', 'Date', {
months: function (i) {
return ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'][i]
},
days: function (i) {