Skip to content

Instantly share code, notes, and snippets.

View marlun78's full-sized avatar

Martin Eneqvist marlun78

View GitHub Profile
/**
* 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) {
@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
@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 / 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 / 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 / jquery.makeplaceholders.js
Last active September 29, 2015 05:57
A fallback for HTML5s placeholder attribute when not supported by the browser
/**
* Make Placeholders jQuery plugin, version 1.0
* Copyright (c) 2012, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* === Description ===
*
* Use as a fallback for HTML5s placeholder attribute when not supported by the browser. It does this by creating a
* placeholder element that has to be positioned over the input. This plugin does not position it for you, but it
* makes it very easy for you to do so.
@marlun78
marlun78 / type.extras.js
Last active October 2, 2015 03:08
Some type util methods.
/**
* Type Extras, version 1.0
* Copyright (c) 2012, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*/
(function (ns) {
// Returns an given element's internal [[Class]] property as a lower-case string
var _toString = Object.prototype.toString,
typeOf = function (object) {
@marlun78
marlun78 / array.extras.js
Last active October 2, 2015 03:08
Some Array util methods.
/*!
* Array Extras, version 1.0
* Copyright (c) 2012, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* Depends on type.extras.js
*/
(function(ns){
// Returns the first index at which a given type can be found in the array, or -1 if it is not present.
@marlun78
marlun78 / underscore-1.3.3-templates.js
Last active April 23, 2023 20:55
Underscore.js templates as a standalone implementation
/*!
Underscore.js templates as a standalone implementation.
JavaScript micro-templating, similar to John Resig's implementation.
Underscore templates documentation: http://documentcloud.github.com/underscore/#template
Modifyed by marlun78
*/
(function () {
'use strict';
@marlun78
marlun78 / setDefaultArguments.js
Last active October 6, 2015 08:27
Adds default param values to a function
/**
* Default Arguments
* Copyright (c) 2012, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* Set default arguments to a function
* @param {function} fn - The function to decorate
* @param {*} [args...] - Any default arguments
* @returns {function} - The new decorated function
*