Skip to content

Instantly share code, notes, and snippets.

@finalfantasia
finalfantasia / fix_gtk_warnings_issues_with_adobe_reader_32_bit_on_64_bit_linux
Created August 21, 2013 06:32
Fixes to some Gtk+ warnings/issues with 32-bit Adobe Reader 9 on 64-bit versions of Linux. These warnings will be shown when the 32-bit Acrobat Reader 9 is launched from within terminals via the 32-bit binary (acroread) on 64-bit versions of Linux. The root cause is the lack of necessary 32-bit (i386) packages on 64-bit versions of Linux. These …
WARNING: Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap":
FIX: sudo aptitude install gtk2-engines-pixbuf:i386
WARNING: Gtk-Message: Failed to load module "canberra-gtk-module"
FIX: sudo aptitude install libcanberra-gtk-module:i386
WARNING: Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita"
FIX: sudo aptitude install gnome-themes-standard:i386
@finalfantasia
finalfantasia / javascript_scoping_and_hoisting.js
Last active August 29, 2015 14:03
JavaScript Scoping and Hoisting
// related write-up
// http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html
// example code
var a = 1;
function b (arguments) {
var a = 3;
@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 / 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 / fun_with_javascript_prototypes.js
Last active August 29, 2015 14:06
Fun with JavaScript Prototypes
// Fun
Object instanceof Function // true
Function instanceof Object // true
// Types of various prototype objects:
typeof Object.prototype === 'object' // true
typeof Boolean.prototype === 'object' // true
typeof Number.prototype === 'object' // true
@finalfantasia
finalfantasia / calculating_the_specificity_of_a_css_selector.md
Last active August 29, 2015 14:08
Calculating a CSS Selector's Specificity

A selector's specificity is represented by concatenating three numbers: a-b-c (in a number system with a large base), which are calculated as follows:

a = the count of ID selectors in the selector
b = the count of class selectors, attributes selectors, and pseudo-classes in the selector
c = the count of type selectors and pseudo-elements in the selector
ignore the universal selector 

Selectors inside the negation pseudo-class are counted like any other, but the negation itself does not count as a pseudo-class.

Examples:

@finalfantasia
finalfantasia / test_double.md
Last active August 29, 2015 14:08
Test Double

Meszaros uses the term Test Double as the generic term for any kind of pretend object used in place of a real object for testing purposes. The name comes from the notion of a Stunt Double in movies. (One of his aims was to avoid using any name that was already widely used.) Meszaros then defined four particular kinds of double:

  • Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
  • Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example).
  • Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.
  • Mocks are what we are talking about here: objects pre-programmed with expectations whi
@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 / using_base16_256_color_themes_in_vim_in_gnome_terminal.md
Last active August 29, 2015 14:10
Using Base16 256-color themes in Vim in GNOME Terminal