Skip to content

Instantly share code, notes, and snippets.

View dtaalbers's full-sized avatar
💻
Doing the computer stuff things..

Tom Aalbers dtaalbers

💻
Doing the computer stuff things..
View GitHub Profile
@erichillah
erichillah / PdfSharpExtension.cs
Last active August 31, 2023 13:35
Extension method to calculate the exact needed Height in which to draw a string using PdfSharp
/// <summary>
/// Enhanced measure string function for PdfSharp Xgraphics
/// wich take to account lineBreaks to calculate the real string
/// height in a rectagle
/// </summary>
/// <param name="gfx"></param>
/// <param name="text">Text to measure</param>
/// <param name="maxWitdh">Maximum allowed width</param>
/// <returns></returns>
public static XSize MeasureStringExact(this XGraphics gfx, string content, XFont font, double maxWidth)
@hanssens
hanssens / DataController.cs
Created August 12, 2015 12:55
DataTables server-side pageable, sorteable and filterable grid
public JsonResult Products(IDataTablesRequest request)
{
// Nothing important here. Just creates some mock data.
var data = ProductFactory.Create();
// Global filtering.
// Filter is being manually applied due to in-memmory (IEnumerable) data.
// If you want something rather easier, check IEnumerableExtensions Sample.
var filteredData = data.Where(_item => _item.Name.Contains(request.Search.Value));
@Arty2
Arty2 / jquery.draggable.js
Last active November 26, 2020 12:28
jQuery plugin to make elements draggable without jQuery UI. Usage: view source on http://jqueryui.com/draggable/
/*--------------------------------------------------------------
Draggable
alternative to jQuery UI’s draggable
based on comments from: http://css-tricks.com/snippets/jquery/draggable-without-jquery-ui/
usage example: $('.post-thumbnail, article header').draggable();
--------------------------------------------------------------*/
(function($) {
if (!jQuery().draggable) {
$.fn.draggable = function() {
this
@NeilJS
NeilJS / gist:5487368
Created April 30, 2013 08:24
Fade in elements in consecutive order.
// Fade in divs consecutively (optional delay)
var delayBetweenEach = 300;
var fadeSpeed = 400;
$(".myDiv").delay(1000).each(function(index) {$(this).delay(delayBetweenEach*index).fadeIn(fadeSpeed);});
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active June 9, 2024 23:19
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version