Skip to content

Instantly share code, notes, and snippets.

@finalfantasia
finalfantasia / improving_text_antialiasing_and_gui_performance_in_intellij_idea_on_openjdk_8.md
Last active April 23, 2024 12:11
Improving Text Anti-aliasing and GUI Performance in IntelliJ IDEA on OpenJDK 8

This is a list of tweaks to make IntelliJ IDEA work better with OpenJDK 8. Refer to System Properties for Java 2D Technology for the details of the options used below.

Note that the performance boost achieved via the OpenGL-based hardware acceleration pipeline is made possible by using the open-source Radeon driver (for AMD graphics cards) included in the latest stable version (10.3.3 as of now) of the Mesa 3D Graphics Library available in the official Fedora 21 stable repository. Therefore, the gained performance boost might vary based on the types of graphics cards and the versions of the drivers used in your system.

  1. Fixing Text Anti-aliasing in Fedora (Ubuntu users may skip this step.)
  2. Fixing text anti-aliasing in IntelliJ IDEA

In $IDEA_HOME/bin/idea64.vmoptions (or $IDEA_HOME/bin/idea.vmoptions on a x86 architecture), change

@finalfantasia
finalfantasia / what_a_good_commit_message_looks_like.md
Last active April 6, 2024 18:38
What a good commit message looks like (Linus Torvalds)

A good commit message looks like this:

Header line: explain the commit in one line (use the imperative)

Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc.

The body of the commit message can be several paragraphs, and

please do proper word-wrap and keep columns shorter than about

@finalfantasia
finalfantasia / fixing_text_anti_aliasing_in_fedora.md
Last active March 20, 2024 22:53
Fixing Text Anti-aliasing in Fedora
  1. Add the RPMFusion repositories (both free and non-free) to the YUM repository directory (/etc/yum.repos.d/):
sudo dnf localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
  1. Install the patched version of FreeType with subpixel rendering enabled:
sudo dnf install -y freetype-freeworld
@finalfantasia
finalfantasia / shadow_cljs_and_fireplace_vim_integration.md
Last active March 8, 2023 19:10
Shadow-CLJS and Fireplace.vim Integration
  1. Create an app following the official Shadow-CLJS Quick Start instructions.
  2. Modify shadow-cljs.edn
;; shadow-cljs configuration
{:source-paths
 ["src/dev"
  "src/main"
  "src/test"]

 ;; ADD - CIDER middleware for nREPL (required by fireplace.vim)
@finalfantasia
finalfantasia / cons_and_lazy_sequences_in_clojure.md
Last active November 7, 2022 16:54
Cons and Lazy Sequences in Clojure

(conj collection item) adds item to collection. To do that, it needs to realize collection. (I'll explain why below.) So the recursive call happens immediately, rather than being deferred.

(cons item collection) creates a sequence which begins with item, followed by everything in collection. Significantly, it doesn't need to realize collection. So the recursive call will be deferred (because of using lazy-seq) until somebody tries to get the tail of the resulting sequence.

The following is how it works internally:

cons actually returns a clojure.lang.Cons object, which is what lazy sequences are made of. conj returns the same type of collection which you pass it (whether that is a list, vector, or whatever else). conj does this using a polymorphic Java method call on the collection itself. (See line 524 of clojure/src/jvm/clojure/lang/RT.java.)

What happens w

@finalfantasia
finalfantasia / pseudo_classical_inheritance_in_javascript.js
Last active September 12, 2022 21:38
Pseudo-classical Inheritance in JavaScript
// Phone
var Phone = function (phoneNumber) {
this._phoneNumber = phoneNumber;
};
Phone.prototype.getPhoneNumber = function () {
return this._phoneNumber;
};
@finalfantasia
finalfantasia / todo_list_redux_reducer.js
Last active February 21, 2022 03:30
Todo List Redux Reducer
// <script src="https://cdnjs.cloudflare.com/ajax/libs/expect/1.20.2/expect.min.js"></script>
// redux api
const combineReducers = reducers =>
(state = {}, action) =>
Object.keys (reducers).
reduce ((accumulator, key) => Object.assign ({}, accumulator, {[key]: reducers [key] (state [key], action)}), {})
<code_scheme name="TW" version="173">
<ClojureCodeStyleSettings>{
:cljs.core/as-&gt; :only-indent
:cljs.core/assoc 0
:cljs.core/cond-&gt; :only-indent
:cljs.core/cond-&gt;&gt; :only-indent
:cljs.core/defonce :only-indent
:cljs.core/with-meta :only-indent
:cljs.core.async/go :only-indent
:cljs.core.async/go-loop :only-indent
@finalfantasia
finalfantasia / solutions_to_4clojure_problems.clj
Last active May 21, 2021 05:50
Solutions to 4Clojure Problems
;;
;; www.4clojure.com
;;
;; #19 last element
(partial reduce (fn [_ x] x))
;; (fn [coll] (reduce (fn [_ x] x) coll))
;; (partial reduce #(identity %2))
;; (partial reduce #(second %&))
@finalfantasia
finalfantasia / java_generics.md
Last active May 8, 2021 16:32
Java Generics

Terms

  • Generic Type
  • Generic Method
  • Type Parameter
  • Type Argument
  • Parameterized Type
  • Type Erasure
  • Wildcard (?)

Example