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 / 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"
/* This work is licensed under Creative Commons GNU LGPL License.
License: http://creativecommons.org/licenses/LGPL/2.1/
Version: 0.9/modified to conform to commonjs modules pattern
Author: Stefan Goessner/2006
Web: http://goessner.net/
*/
var json2xml = (typeof exports === 'undefined')? {} : exports; // like commonjs