Skip to content

Instantly share code, notes, and snippets.

View maizy's full-sized avatar
🕊️
-

Nikita Kovalev maizy

🕊️
-
View GitHub Profile
@maizy
maizy / repl.txt
Created June 1, 2015 16:16
Anonymous func from method with implicit params?
$ scala
Welcome to Scala version 2.11.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_67).
Type in expressions to have them evaluated.
Type :help for more information.
scala> class MyContext2(val m: Int)
defined class MyContext2
scala> object TestObj2{ def withImp(s: String)(implicit c: MyContext2): String = s"c:${c.m}" }
defined object TestObj2
@maizy
maizy / node.md
Created August 12, 2015 10:48
install node v0.10.36 with brew in os x
cd /usr/local/Library/Formula
brew remove node --force
git checkout b64d9b9c431642a7dd8d85c8de5a530f2c79d924
brew install node
git checkout master

based on https://gist.github.com/mpesic/3759330

// file: src/multi-jvm/scala/SupervisortClusterEventsSpec.scala
//
// Required properly multi-jvm setup:
// http://doc.akka.io/docs/akka/snapshot/scala/cluster-usage.html#How_to_Test
//
// based on example from akka docs
import scala.collection.mutable
import scala.concurrent.duration._
import org.scalatest.{ Suite, BeforeAndAfterAll, FlatSpecLike, Matchers }
@maizy
maizy / letter.txt
Last active October 27, 2015 07:37
письмо счастья (выужено из спама)
Dr. Harry Thomas <acct.contfarmkalimantan@___.com>
Д-р Томас Гарри Brondesbury, Северо-Запад Лондон, Англия
Дорогой друг.
Я доктор Гарри Томас из Brondesbury, Северо-Запад Лондон, здесь, в Англии. Я
работаю на UBS Investment Bank London. Я пишу вам о бизнес-предложение,
которое будет из огромную пользу для нас обоих. В моем отделе, в качестве
@maizy
maizy / README.md
Last active December 10, 2015 13:55
python cli encoding
$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
@maizy
maizy / isolation.py
Created February 19, 2013 14:00
nosetests --with-isolations
# nosetests --with-isolation isolation.py
class T1(unittest.TestCase):
def a_test_set_global_val(self):
import math
math.abbb = 12
self.assertTrue(math.abbb == 12)
def b_test_get_global_val_in_same_testcase(self):
import math
@maizy
maizy / cors-test.html
Last active December 14, 2015 04:38
CORS test page
<!DOCTYPE html>
<html>
<head>
<title>CORS test</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<style type="text/css">
body {
font-family: Lucida, sans-serif;
}
form.options,
@maizy
maizy / Monkai_maizy_edition.xml
Created April 7, 2013 06:01
Monokai color sheme for IDEA
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="Monokai-maizy-edition" version="1" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="16" />
<option name="CONSOLE_FONT_NAME" value="Monaco" />
<option name="CONSOLE_FONT_SIZE" value="12" />
<option name="EDITOR_FONT_NAME" value="Lucida Sans Typewriter" />
<colors>
<option name="CARET_COLOR" value="f8f8f0" />
<option name="CARET_ROW_COLOR" value="25241a" />
@maizy
maizy / query.py
Last active December 17, 2015 09:59
dict-like object for url query string building
# _*_ coding: utf-8 _*_
from copy import deepcopy
import json
from lxml import etree
from frontik import make_qs
class QueryStringDict(dict):
"""
dict-like object for url query string building.
@maizy
maizy / buf_vs_join.py
Last active December 18, 2015 16:49
join str with cStringIO vs ''.join(); ipython -i buf_vs_join.py
# coding: utf-8
from cStringIO import StringIO
def test_buf(i):
buf = StringIO()
for v in i:
buf.write(v)
return buf.getvalue()
def test_join(i):