Skip to content

Instantly share code, notes, and snippets.

@yalovek
yalovek / install.sh
Last active August 29, 2016 11:23
Installation guide of OSM project for OS X
#!/bin/sh
# Install brew
xcode-select --install
http://xquartz.macosforge.org/landing/
http://support.apple.com/kb/DL1572
@yalovek
yalovek / paint.py
Last active August 29, 2016 11:19
Simple Paint
from turtle import *
import math
class MyTurtle(Turtle):
def rectangle(self,a,b):
self.fd(a)
self.lt(90)
self.fd(b)
self.lt(90)
self.fd(a)
self.lt(90)
#!/usr/bin/env sh
# Install new vim
sudo apt-get build-dep vim
unzip vim-master.zip
cd vim-master
make
sudo make install
hash -r
vim --version
@yalovek
yalovek / checkParams.js
Created August 29, 2016 11:07
Check url params for XSS: window.location = 'javascript://a%0aalert%28document.cookie%29'
window.location.search.substr(1).split('&').map(value => {
return value.split('=')[1];
}).filter(value => {
const parser = document.createElement('a');
parser.href = value;
return parser.protocol === "javascript:";
}).length;
@yalovek
yalovek / anagram.js
Last active October 23, 2016 15:24
Function for checking array of words for anagrams
/**
* Function for checking array of words for anagrams
* @param {Array} words Array of words
* @return {Array} Array of arrays with anagram words
*/
const anagram = words => words.reduce((result, word) => {
if (!result[word.length]) {
result[word.length] = [word];
}
else {
@yalovek
yalovek / sum.js
Created October 17, 2016 07:03
Calculating sum of numbers sum(2)(3)(4)
function sum(x) {
const f = y => sum(x + y);
f.valueOf = () => x;
return f;
}
@yalovek
yalovek / translitCyrillicToLatin.js
Last active October 23, 2016 16:24
Translit cyrillic to latin
/**
* Function for translitirating cyrillic to latin
* @param {String} word Word on cyrillic
* @return {String} Word translitirated to latin
*/
const translitCyrillicToLatin = word => {
const translitMap = {
'а': 'a',
'б': 'b',
'в': 'v',
@yalovek
yalovek / translitLatinToCyrillic.js
Created October 23, 2016 16:26
Translit latin to cyrillic
/**
* Function for translitirating latin to cyrillic
* @param {String} word Word on latin
* @return {String} Word translitirated to cyrillic
*/
const translitLatinToCyrillic = word => {
const translitMap = {
'a': 'а',
'b': 'б',
'c': 'ц',
@yalovek
yalovek / convertKeyboardKeysLatinToCyrillic.js
Created October 23, 2016 16:49
Convert keyboard keys from latin to cyrillic
/**
* Function for converting keyboard keys from latin to cyrillic
* @param {String} word Word on latin
* @return {String} Word converted to cyrillic
*/
const convertKeyboardKeysLatinToCyrillic = word => {
const keyboardMap = {
'a': 'ф',
'b': 'и',
'c': 'c',
@yalovek
yalovek / convertKeyboardKeysCyrillicToLatin.js
Created October 24, 2016 19:58
Convert keyboard keys from cyrillic to latin
/**
* Function for converting keyboard keys from cyrillic to latin
* @param {String} word Word on cyrillic
* @return {String} Word converted to latin
*/
const convertKeyboardKeysCyrillicToLatin = word => {
const keyboardMap = {
'ф': 'a',
'и': 'b',
'c': 'c',