Skip to content

Instantly share code, notes, and snippets.

View yarkovaleksei's full-sized avatar
🏠
Working from home

Yarkov Aleksey yarkovaleksei

🏠
Working from home
  • Russia, Rostov-on-Don
View GitHub Profile
@yarkovaleksei
yarkovaleksei / js-crypto-libraries.md
Created December 25, 2015 08:20 — forked from jo/js-crypto-libraries.md
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

I start with a list and plan to create a comparison table.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

@yarkovaleksei
yarkovaleksei / random.js
Created April 15, 2016 08:56 — forked from kerimdzhanov/random.js
Javascript get random number in a specific range
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {float} a random floating point number
*/
function getRandom(min, max) {
return Math.random() * (max - min) + min;
}
@yarkovaleksei
yarkovaleksei / urlobject.js
Created April 20, 2016 07:36 — forked from aymanfarhat/urlobject.js
JS utility function that: - Breaks down url to an object with accessible properties: protocol, parameters object, host, hash, etc... - Converts url parameters to key/value pairs - Convert parameter numeric values to their base types instead of strings - Store multiple values of a parameter in an array - Unescape parameter values
function urlObject(options) {
"use strict";
/*global window, document*/
var url_search_arr,
option_key,
i,
urlObj,
get_param,
key,
@yarkovaleksei
yarkovaleksei / parse-options.sh
Created June 10, 2016 10:24 — forked from cosimo/parse-options.sh
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"
@yarkovaleksei
yarkovaleksei / screenshot.md
Created June 11, 2016 09:13 — forked from jeefave/screenshot.md
javascript

Js express screenshot

$.getScript('https://github.com/niklasvh/html2canvas/releases/download/0.4.1/html2canvas.js', function(){
   html2canvas(document.body, {
       //height: 1024,
       //width: 768,
       //background: '#fff',
       onrendered: function(canvas) {
           window.open(canvas.toDataURL( /* "image/jpeg" */ ));

}

Javascript Public, Private Instance Methods

    
    var array = [];
    
    var object = {};
    
    var method = function () {};
    
    var instance = new function (privateField, a, b) {
### Default text editor
export EDITOR=subl
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
1. Сгенерировать ключ с помощью PuttyGen
1.1. Сохранить private key в файл.
1.2. Скопировать публичный ключ в буфер обмена
2. Добавить скопированные публичный ключ в BitBucket (Manage Account -> SSH key)
3. Запустить PAgent и добавить приватный ключ.
4. Выполнить команду: plink git@bitbucket.org
4.1. На вопрос: Store key in cache? (y/n) ответить y
@yarkovaleksei
yarkovaleksei / post-commit
Created August 6, 2016 20:26 — forked from bonndan/post-commit
gh-pages post commit hook
#!/bin/sh
branch=$(git rev-parse --abbrev-ref HEAD)
if [ "gh-pages" == "$branch" ]; then
exit
fi
echo Updating gh-pages for branch $branch
git checkout gh-pages
git checkout $branch -- dist
@yarkovaleksei
yarkovaleksei / 1: helloworld
Created November 21, 2016 00:27 — forked from marthall/1: helloworld
Very basic python packaging
#!/usr/bin/env python
print "Hello World"