Skip to content

Instantly share code, notes, and snippets.

@Ovsyanka
Ovsyanka / fullYearsBetween.js
Created January 22, 2014 10:46
calculate full years number between two dates
yearsBetween = function(d1, d2, roundUp) {
// dates parsing by sugarjs
var d1 = Date.create(d1);
var d2 = Date.create(d2);
var range = d2.getFullYear() - d1.getFullYear();
if (d2.setFullYear(1972) < d1.setFullYear(1972)) range--;
if (roundUp && d2.getTime() !== d1.getTime()) range++;
return range;
@Ovsyanka
Ovsyanka / printParentShellUserName.sh
Created September 27, 2015 17:09
linux: parent shell user
#!/bin/bash
parentShellUser=`ps u -p $PPID | awk '{print $1}'|tail -1`
echo $parentShellUser
@Ovsyanka
Ovsyanka / assignToGroup.sh
Created September 27, 2015 17:30
Take assigning to group without relogin
#!/bin/bash
# it can not be executed as script because newgrp starting a new shell
# src: http://superuser.com/questions/272061/reload-a-linux-users-group-assignments-without-logging-out/345051#345051
newGrpName=<grpName>
currentGrpId=`id -g`
exec newgrp $newGrpName
exec newgrp #$currentGrpId
@Ovsyanka
Ovsyanka / ruleset.xml
Last active February 20, 2020 11:10 — forked from gsherwood/ruleset.xml
PSR2 with tabs instead of spaces and bracers on the end of lines
<?xml version="1.0"?>
<ruleset name="MyStandard">
<description>
PSR2 with changes:
* tabs instead of spaces (https://gist.github.com/gsherwood/9d22f634c57f990a7c64)
* bracers on end of line instead new line
</description>
<!-- tabs -->
<arg name="tab-width" value="4"/>

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages