Skip to content

Instantly share code, notes, and snippets.

View gontard's full-sized avatar

Sébastien Boulet gontard

View GitHub Profile
@ruizb
ruizb / README.md
Last active February 22, 2024 15:46
A glossary of TypeScript.

A glossary of TypeScript

Motivation

Once upon a time, there was a developer that had an issue using the TypeScript language. He wanted to share his issue with the community to get help, but he didn't know how to properly write the title that would best describe his problem. He struggled to find the appropriate words as he didn't know how to name "this behavior" or "that kind of type mechanism".

This story encouraged me to start writing a glossary of TypeScript. Hopefully it will help you if you have to look for an issue, write an issue, or communicate with other TypeScript developers.

Disclaimer: it was me, I was the developer that struggled. I still struggle though, but this means I still have things to learn, which is great!

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@gpiffault
gpiffault / piecewise.js
Last active June 1, 2018 14:20
Javascript piecewise function factory
function Piecewise(xs, ys) {
return function(x) {
//bisect
var lo = 0, hi = xs.length - 1;
while (hi - lo > 1) {
var mid = (lo + hi) >> 1;
if (x < xs[mid]) hi = mid;
else lo = mid;
}
//project
@andytill
andytill / JavaFXThreadingRule.java
Created October 4, 2012 19:42
A Junit @rule for running tests on the JavaFX thread
import java.util.concurrent.CountDownLatch;
import javax.swing.SwingUtilities;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import org.junit.Rule;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
@rherrmann
rherrmann / EqualsTester.java
Last active August 29, 2022 07:10
Utility class to help unit testing equals() and hashCode(), see also http://www.codeaffine.com/2012/06/25/how-do-you-test-equals-and-hashcode/
/*******************************************************************************
* Copyright (c) 2012 Rüdiger Herrmann
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rüdiger Herrmann - initial API and implementation
* Frank Appel - code review, idea for assertEquals( T, Object, Object )
@jewelsea
jewelsea / BoundsPlayground.java
Created December 7, 2011 08:14
Demo for understanding JavaFX Layout Bounds
import javafx.application.Application;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
@andrewspencer
andrewspencer / StringUtil.java
Created May 2, 2011 14:40
Remove accents from a String
package net.andrewspencer.util;
import sun.text.Normalizer; // java.text.Normalizer in 1.6
/**
* Here's how to remove accents in Java 1.5.
* NB Doesn't separate ligatures.
*/
// WARNING Uses unofficial Sun classes, so JVM-dependent.
// Normalizer became standard in Java 1.6, though.
#!/bin/bash
# NOTE: this is an OSX launchd wrapper shell script for Tomcat (to be placed in $CATALINA_HOME/bin)
CATALINA_HOME=/Users/username/tomcat
function shutdown() {
date
echo "Shutting down Tomcat"
$CATALINA_HOME/bin/catalina.sh stop