Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Chuchunkov madfriend

  • Yandex, OpenCorpora
  • St. Petersburg, Russia
View GitHub Profile
View ex.js
let div = document.createElement('div');
div.style.height = '100px';
div.style.width = '100px';
div.style.background = 'red';
div.style.display = 'inline-block';
document.body.appendChild(div);
View gist:f6b55c63f8c073c830f1c25ce64db9a0
let div = document.createElement('div');
div.style.height = '100px';
div.style.width = '100px';
div.style.background = 'red';
div.style.display = 'inline-block';
document.body.appendChild(div);
View animate.js
let frameCounter = 0;
function countFrames () {
frameCounter++;
requestAnimationFrame(countFrames);
}
requestAnimationFrame(countFrames);
function* animate (from, to, numFrames) {
View logistic_regression.py
#! coding: utf-8
# sklearn = библиотека scikit-learn (http://scikit-learn.org)
# Установить можно, например, так:
# сначала поставить дистрибутив Anaconda (https://www.continuum.io/downloads#_windows)
# а потом в терминале "conda install sklearn".
# Нам из sklearn нужно не так много
from sklearn.linear_model import LogisticRegression
# в sklearn есть удобная функция для создания
# отчетов по качеству классификации (Precision, Recall, F1)
from sklearn.metrics import classification_report
View test.tag
<my-parent-tag>
<div>
this is parent tag
<script type="riot/tag" src="https://rawgit.com/madfriend/51a535e989b710429334/raw/18753e624291e350e3f230aaece6a93be3785299/test2.tag"></script>
<my-tag>this should be replaced by my-tag contents</my-tag>
</div>
</my-parent-tag>
@madfriend
madfriend / snip.js
Created Sep 10, 2015
my jquery snippets
View snip.js
$.fn.mapGetter = function(prop) {
return $(this).map(function(i, e) {
return $(e).attr(prop);
}).get();
};
$.fn.filterByAttr = function(attr, val) {
return $(this).filter(function(i, e) {
return $(e).attr(attr) == val;
});
@madfriend
madfriend / be.html
Last active Aug 29, 2015
be with m decoupled
View be.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BE with M decoupled</title>
</head>
<body>
<div class="container">
<div class="new-label-form is-hidden">
<h2 class="new-label-form--title">
@madfriend
madfriend / gost-r-madfriend.csl
Created Mar 29, 2015
ГОСТ Р 7.0.1-2003 + 7.0.5-2008 для Zotero (мопед не мой, но что-то правил для себя)
View gost-r-madfriend.csl
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0">
<info>
<title>Russian GOST R 7.0.1-2003 + 7.0.5-2008 numeric (madfriend)</title>
<id>http://www.zotero.org/styles/gost-r-7-0-5-2008-num-appear</id>
<link href="http://www.zotero.org/styles/gost-r-7-0-5-2008-num-appear" rel="self"/>
<link href="https://dl.dropboxusercontent.com/u/95616327/Permanent_files/GOST-for-Zotero-Documentation.zip" rel="documentation"/>
<author>
<name>Roman Raspopov</name>
<email>romanraspopov@gmail.com</email>
View grammar.g
start: program;
program: outer_block*;
outer_block: (outer_line NEWLINE)*
outer_line?;
@outer_line: initialization
| assignment
';';
assignment: name '='