Skip to content

Instantly share code, notes, and snippets.

View marlun78's full-sized avatar

Martin Eneqvist marlun78

View GitHub Profile
@marlun78
marlun78 / git-watch.sh
Created February 12, 2024 08:15
Continuously visualize git branches and commits in the terminal
# Requires `watch`, if on macOS, `brew install watch`
watch -ct -n1 git --no-pager log --color --all --oneline --decorate --graph
@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 / mround.ts
Last active March 23, 2023 17:05
A TypeScript implementation of the `mround` function from Google Sheets, Microsoft Excel etc.
/**
* Rounds one number to the nearest integer multiple of another.
* @param value The number to round to the nearest integer multiple of another.
* @param factor The number to whose multiples value will be rounded.
* @example
* mround(10, 3); // 9
* mround(-10, -3); // -9
* mround(5, -2); // Error: Parameters of mround must have same signs (both positive or both negative)
*/
export function mround(value: number, factor: number): number {
@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 / react-lazy-component.html
Last active November 29, 2022 22:00
React Lazy Component Demo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>React Lazy Component Demo</title>
</head>
<body>
<div id="root">This is the React root</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.development.js" integrity="sha512-m7nhpWHotpucPI37I4lPovL28Bm2BhAMV8poF3F8Z9oOEZ3jlxGzkgvG0EMt1mVL1xydr1erlBbmN90js/ssUw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
@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 / 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 / flat-map.ts
Last active October 21, 2020 08:11
TypeScript flatMap
export const flatMap = <T, U>(
array: T[],
callback: (value: T, index: number, array: T[]) => U
): U[] => {
return Array.prototype.concat(...array.map(callback));
};
# 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