Skip to content

Instantly share code, notes, and snippets.

[
{ "keys": ["ctrl+shift+n"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }
]
@dastanko
dastanko / .gemrc
Created April 1, 2013 07:13
gem:gemrc
gem: --no-ri --no-rdoc
@dastanko
dastanko / CesarCipher.java
Last active September 2, 2019 16:56
Шаблон на Java
public class CesarCipher {
private char[] alphabet;
private int shift;
public void setAlphabet(char[] alphabet) {
this.alphabet = alphabet;
}
public void setShift(int shift) {
@dastanko
dastanko / CesarCipher.rb
Last active December 18, 2015 03:48
Шаблон на Ruby
class CesarCipher
attr_writer :alphabet, :shift
def encode(plain_text)
# реализация
return encoded_text
end
end
@dastanko
dastanko / CesarCipher.py
Last active December 18, 2015 03:48
Шаблон Python
class CesarCipher(object):
_alphabet = None
_shift = None
def set_alphabet(self, value):
self._alphabet = value
def set_shift(self, value):
self._shift = value
@dastanko
dastanko / CesarCipher.php
Last active December 18, 2015 04:49
Шаблон на php
<?php
class CesarCipher {
private $alphabet;
private $shift;
public function setAlphabet($alphabet)
{
$this->alphabet = $alphabet;
}
@dastanko
dastanko / CesarCipher.cs
Last active December 18, 2015 07:28
Шаблон на C#
public class CesarCipher
{
public char[] Alphabet { private get; set; }
public int Shift { private get; set; }
public string Encode(string plainText)
{
// Реализация
return encoded_text;
@dastanko
dastanko / djvu2pdf
Created August 17, 2013 16:55
bash:convertToPDF
#!/bin/bash
# convert DjVu -> PDF
# usage: djvu2pdf.sh <file.djvu>
# depends on ddjvulibre package, To install package run `sudo apt-get install ddjvulibre`
i="$1"
echo "------------ converting $i to PDF ----------------";
o="`basename $i .djvu`"
o="$o".pdf
@dastanko
dastanko / runner.py
Created December 7, 2013 18:59 — forked from carljm/runner.py
"""
An alternative Django ``TEST_RUNNER`` which uses unittest2 test discovery from
a base path specified in settings, rather than requiring all tests to be in
``tests`` module of an app.
If you just run ``./manage.py test``, it'll discover and run all tests
underneath the ``TEST_DISCOVERY_ROOT`` setting (a path). If you run
``./manage.py test full.dotted.path.to.test_module``, it'll run the tests in
that module (you can also pass multiple modules).
#coding=utf-8
from unittest import TestCase
class XmlSerializable(object):
def to_xml(self):
raise NotImplementedError("This must implemented in all XmlSerializable objects")
class Document(XmlSerializable):