Skip to content

Instantly share code, notes, and snippets.

View dknight's full-sized avatar

Dmitri Smirnov dknight

View GitHub Profile
@dknight
dknight / nobel.css
Created July 31, 2012 06:59
Nobel webfont CSS
/*
This CSS resource incorporates links to font software which is
the valuable copyrighted property of WebType LLC, The Font Bureau
and/or their suppliers. You may not
attempt to copy, install, redistribute, convert, modify or reverse
engineer this font software. Please contact WebType with any
questions: http://www.webtype.com
*/
@font-face {
font-family: 'NobelWGLRegular';
@dknight
dknight / Russian.php
Created March 29, 2012 14:04
Convert Russian letters to Latin
<?php
/**
* Converts Russian letters to Latin
*
* Usage:
* <code>
* Russian::transliterate('Привет, как дела?');
* Russian::transliterateUrl('Привет, как дела?');
@dknight
dknight / fix.html
Created March 27, 2012 12:45
Web smooth for Lexus
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Fix</title>
<link href="http://fast.fonts.com/cssapi/ffc13c3f-bd97-4083-bd23-6026005cd713.css" rel="stylesheet">
<script>
var windows = (navigator.appVersion.indexOf("Win") != -1);
var chrome = (navigator.userAgent.indexOf("Chrome") >= -1);
var ie = (navigator.userAgent.indexOf("MSIE") >= -1);
var estonian = {
months: "Jaanuar,Veebruar,Märts,Aprill,Mai,Juuni,Juuli,August,September,Oktoober,November,Detsember",
shortMonths: "jaan.,veebr.,märts,apr.,mai,juuni,juuli,aug.,sept.,okt.,nov.,dets.",
days: "Pühapäev,Esmaspäev,Teisipäev,Kolmapäev,Neljapäev,Reede,Laupäev",
shortDays: "P,E,T,K,N,R,L"
};
var russian = {
months: "Январь,Февраль,Март,Апрель,Май,Июнь,Июль,Август,Сентябрь,Октябрь,Ноябрь,Декабрь",
shortMonths: "янв,фев,мар,апр,май,июн,июл,авг,сен,окт,ноя,дек",
@dknight
dknight / Levenstein.rb
Created November 16, 2010 09:46
Levenshtein distance
class String
def levenstein(other, ins=2, del=1, sub=1)
return nil if self.nil? || other.nil?
dm = []
dm[0] = (0..self.length).collect { |i| i * ins}
fill = [0] * (self.length - 1)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Dmitri Smirnov">
<!-- Date: 2010-08-23 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Prototype JS - My template for tutorials</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head>
<body>
function multiple_ru($num)
{
$num = (string)$num;
switch( substr($num, -1)) {
case 0:
$retval = 'пунктов';
break;
case 1:
$retval = substr($num, -2) == '11' ? 'пунктов' : 'пункт';
break;