Skip to content

Instantly share code, notes, and snippets.

View erichillah's full-sized avatar

Eric Hillah erichillah

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)
import React from 'react'
import { render } from 'react-dom'
import { Match, Link, BrowserRouter as Router } from 'react-router'
import matchSorter from 'match-sorter'
import './styles.css'
const API = 'http://localhost:3000'
const token = localStorage.booksToken || Math.random().toString()
localStorage.booksToken = token
@tomkis
tomkis / rxjs-saga.js
Last active May 13, 2018 14:01
rxjs-saga.js
import { createStore, applyMiddleware } from 'redux';
import { Observable, Subject } from 'rxjs';
const api = (url, fail) => {
console.log(`Loading API ${url}`);
return new Promise((res, rej) => setTimeout(() => fail ? rej(`data-${url}`) : res('SUCCESS'), 1000));
};
const customSaga = iterable =>
iterable
@nicolashery
nicolashery / rxjs-react.js
Last active August 1, 2022 03:36
Fetching data asynchronously with RxJS and React
import React from 'react';
import _ from 'lodash';
import Rx from 'rx';
import superagent from 'superagent';
let api = {
host: 'http//localhost:3001',
getData(query, cb) {
superagent
@Turbo87
Turbo87 / app.js
Created February 15, 2015 04:05
webpack + font-awesome test
require('font-awesome/css/font-awesome.css');
document.body.innerHTML = '<i class="fa fa-fw fa-question"></i>';
@staltz
staltz / introrx.md
Last active May 1, 2025 10:51
The introduction to Reactive Programming you've been missing
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Reflection.Emit;
using System.Collections.Concurrent;
using System.Data;
using System.Reflection;