Skip to content

Instantly share code, notes, and snippets.

View marlun78's full-sized avatar

Martin Eneqvist marlun78

View GitHub Profile
@marlun78
marlun78 / jquery.autogrow.js
Last active October 6, 2015 08:28
A jQuery plugin that converts a textarea to a auto-growing textarea
/**
* Autogrow, version 1.0
* Copyright (c) 2012, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* A jQuery plugin that converts a textarea to a (Facebook-like) auto-growing textarea.
* Built for jQuery 1.5.1
*/
$.fn.autogrow = function () {
var refresh = function (area, element) {
@marlun78
marlun78 / httpStatusCodes.js
Last active October 23, 2020 00:45
An HTTP Status Codes object
/**
* HTTP Status Codes
* Copyright (c) 2012, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* Taken from: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
* Visual Studio find regex: ^(\d{3}) ([^\r\n]+)\r\n
* Visual Studio replace regex: '$1': '$2', //
* Notes wrapped in parens moved manually
*/
@marlun78
marlun78 / parseUrl.js
Last active October 13, 2015 15:07
JavaScript URL parser
/**
* parseUrl
* Copyright (c) 2012, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* Needs to run in a browser, uses String.prototype.lastIndexOf method.
* Regexp stolen from: http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
*/
var parseUrl = (function (element) {
@marlun78
marlun78 / simpleCanvasSpinner.js
Last active December 12, 2015 03:29
A simple <canvas> spinner
/**
* Canvas Loading Spinner
* Copyright (c) 2013, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*/
(function(){
'use strict';
var _lineCaps = ['butt', 'round', 'square'],
/**
* Handlebars eachIn helper
* Copyright (c) 2013, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* Description:
* A Handlebars helper to iterate over object properties rather than arrays.
*
* Usage:
* <script id="list-object" type="text/x-handlebars-template">
# How to install `ipkg` on a Synology DS214
After a couple of days of trying to get `ipkg` woking on my DS214 I found [this article](https://github.com/trepmag/ds213j-optware-bootstrap) by [trepmag](https://github.com/trepmag). It is written for the DS213j, but it’s been working for me and [others](https://github.com/alberthild) for the DS214 too.
I have done some minor changed to clarify some things, but if you are a Linux guy (unlike me) my changes might be of no use to you.
## Guide
@marlun78
marlun78 / di.js
Last active August 29, 2015 13:57
JavaScript dependency injection - sort of...
/**
* Dependency Injection
* Copyright (c) 2014, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* === EXAMPLE ===
* //Some module...
* (function () {
* var di = window.di;
*
@marlun78
marlun78 / SOFS.js
Last active August 29, 2015 13:57
Self-overwriting function statement - an alternative to IIFE?
/**
* Self-overwriting Function Statement (SOFS)
* Copyright (c) 2013, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* === EXAMPLE ===
* console.log('---');
* console.log('SOFS return:', sofs());
* console.log('SOFS return:', sofs());
* console.log('---');
@marlun78
marlun78 / express-server.js
Last active June 14, 2021 06:50
Super simple express sever for serving static content
/**
* Simple express sever
* Copyright (c) 2014, marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*
* Assumes this folder structure
* /public
* /server
*
* Express: http://expressjs.com
@marlun78
marlun78 / evts.js
Last active August 29, 2015 14:00
Minimal Events
/**
* Minimal Events
* Copyright (c) 2013 marlun78
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83
*/
// TODO: Rework “once”
window.evts = (function () {
'use strict';