Skip to content

Instantly share code, notes, and snippets.

View yegor256's full-sized avatar
😀
reinventing OOP...

Yegor Bugayenko yegor256

😀
reinventing OOP...
View GitHub Profile
@bl4ck5un
bl4ck5un / palatino.tex
Created September 26, 2015 02:04
Using Palatino font in LaTeX
\usepackage{tgpagella} % text only
\usepackage{mathpazo} % math & text
@yegor256
yegor256 / quiz.java
Last active November 9, 2023 12:52
quiz.java
/**
* Please review the class below and suggest improvements. How would
* you refactor this class if it would be in a real-life project?
* There are many problems here, both high-level design mistakes,
* and low-level implementation bugs. We're interested to see high-level
* problems first, since they are most critical. The more mistakes
* you can spot, the better programmer you are.
*/
/**
@DiogoDoreto
DiogoDoreto / XSLT 1.0
Created July 3, 2013 17:13
Distinct values in XSLT 1.0
<xsl:key name="product" match="/items/item/products/product/text()" use="." />
<xsl:template match="/">
<xsl:for-each select="/items/item/products/product/text()[generate-id()
= generate-id(key('product',.)[1])]">
<li>
<xsl:value-of select="."/>
</li>
</xsl:for-each>
@nimbus154
nimbus154 / dictionary.py
Created April 21, 2013 23:54
An example of how to write functional tests for a RESTful API using the Bottle microframework.
from bottle import get, run, request, post, Bottle, abort, error, response, debug, redirect
# This is a dictionary endpoint. It retrieves definitions for words.
# You can also add words to the dictionary.
# this allows our bottle application to be accessible outside this file
app = Bottle()
dictionary = {
"lugubrious": "extremely sad",
@tomasmuller
tomasmuller / str_to_hex.rb
Created February 6, 2012 11:30
Ruby String to Hexadecimal
s = "Tomás Augusto Müller"
# Hex Array
#
s.unpack('U' * s.length).collect { |x| x.to_s(16) }
# Hex String
#
s.unpack('U' * s.length).collect { |x| x.to_s(16) }.join