Skip to content

Instantly share code, notes, and snippets.

View mrfratello's full-sized avatar

John Syomochkin mrfratello

View GitHub Profile
@mrfratello
mrfratello / mercurial.ini
Last active April 24, 2018 19:36
SmartSynchronize as merge tool for mercurial on Windows
[extdiff]
cmd.smarts = C:\Program Files (x86)\SmartSynchronize\bin\smartsynchronize.exe
[merge-tools]
smarts.args = $local $other $base
smarts.executable= C:\Program Files (x86)\SmartSynchronize\bin\smartsynchronize.exe
smarts.priority = 1000
smarts.premerge=False
smarts.checkconflict=True
smarts.binary=True
@mrfratello
mrfratello / withClass.py
Created May 20, 2016 12:51
State saver on Python
class saver:
state = 0
def __init__(self, start):
self.state = start
def __call__(self, additional):
self.state += additional
return self.state
acc = saver(10)
@mrfratello
mrfratello / .gitconfig
Last active February 5, 2018 09:48
gitconfig with alias and mergetool as meld
[user]
# Please adapt and uncomment the following lines:
name = username
email = email
[alias]
st = status
co = checkout
ci = commit
br = branch
@mrfratello
mrfratello / ajax.js
Last active August 13, 2016 09:07
AJAX on pure JS
function getXmlHttp(){
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
@mrfratello
mrfratello / BracketHighlighter.sublime-settings
Last active March 12, 2018 11:29
Packages for Sublime Text 3
{
// Show brackets in the minimap.
// Depending on your highlight style, regions may not be visible in minimap.
// "underline" won't show up due to it being a style consisting of
// multiple zero width selections to create a fat underline.
// But the following styles should show up fine as they are normal regions styles:
// - thin_underline
// - solid
// - outline
// - squiggly
@mrfratello
mrfratello / .hgignore
Created August 25, 2016 09:40
Mercurial: ignore files in a specific folder but not the folder itself
^some_folder/(?!\.keep).+$
@mrfratello
mrfratello / git-stat-by-authors.sh
Last active January 22, 2018 22:11
Statistics by author in SCM Git
git log --pretty=format:==%an --numstat | \
sed -r '/==.*/{s/^==//;h;D};/^$/D;s/-/0/g;s/\t[^\t]+$//;G;s/(.*)\n(.*)/\2\t\1/' \
| awk -F '\t' '{add[$1]+=$2;del[$1]+=$3} END {for (i in add) {print i,add[i],del[i]}}'
# Статистика количества коммитов у каждого автора
git shortlog -sne
# Статистика по количеству строк каждого автора в текущей (итоговой) ревизии
ssh-add ~/.ssh/id_rsa
@mrfratello
mrfratello / MacDown.css
Last active October 18, 2017 22:10
CSS styles for MarkDown in different apps: MacDown.app, SublimeText
body {
font-family: "Times New Roman", Helvetica, arial, sans-serif;
font-size: 14pt;
line-height: 1.5;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@mrfratello
mrfratello / ajax_jquery.html
Created February 12, 2017 17:30
html template with example of ajax-request using jQuery library.
<!DOCTYPE html>
<html>
<head>
<title>AJAX on jQuery Example</title>
</head>
<body>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
jQuery.ajax({
url: '/some_page',