Skip to content

Instantly share code, notes, and snippets.

@MarcoWorms
MarcoWorms / mini-redux.js
Last active June 3, 2024 04:42
Redux in a nutshell
function createStore (reducers) {
var state = reducers()
const store = {
dispatch: (action) => {
state = reducers(state, action)
},
getState: () => {
return state
}
}
@bengolder
bengolder / itext_unicode.java
Last active April 17, 2021 12:57
examples from people using unicode in itext
// from http://osdir.com/ml/java.lib.itext.general/2006-03/msg00662.html
PdfReader pdf = new PdfReader("C:\\VorlageOnline.pdf");
PdfStamper stp = new PdfStamper(pdf, new FileOutputStream("c:\\out.pdf"));
AcroFields af = stp.getAcroFields();
BaseFont bf = BaseFont.createFont("c:\\windows\\fonts\\l_10646.ttf", BaseFont.IDENTITY_H, true);
af.addSubstitutionFont(bf);
af.setField("field1","This is a Test Müller");
stp.close();
// from http://developers.itextpdf.com/examples/itext-action-second-edition/chapter-8#328-textfieldfonts.java
@basham
basham / css-units-best-practices.md
Last active October 26, 2025 18:37
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units