This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Useful when you have more users in Jira than your license limit allows and some of them are inactive. | |
* Say, you have 89 users, while your license allows only 50. Some of current users are inactive. | |
* You hired 2 people and want to find out whether there's enough room for them. And if not - which users | |
* are candidates for removal. Problem is there's no "only active" filter and no sorting by last login date | |
* on users page in Jira. This script helps solve these problems. | |
* | |
* To use this script: | |
* - go to Administration in your Jira | |
* - go to Users page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Renderer2, NgZone } from '@angular/core'; | |
import { Subject } from 'rxjs/Subject'; | |
export class EventDebouncer { | |
constructor(private _zone: NgZone, private _renderer: Renderer2) { | |
} | |
listen( | |
target: 'window' | 'document' | 'body' | any, | |
eventName: string, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
function select_branch() { | |
echo "Not merged branches on origin:" | |
branches=`git branch --list -r --no-merged` | |
IFS=$'\n' read -d '' -r -a branches_arr <<< "$branches" || true # dunno why, IFS raises error code | |
if [ ${#branches_arr[@]} -eq 0 ]; then | |
echo "\e[93mNo unmerged remote branches found\e[0m" | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Observer, Observable, ReplaySubject, Subscriber } from 'rxjs/Rx'; | |
interface IObserver<T> { | |
next(value?: T): void; | |
error(err: any): void; | |
complete(): void; | |
} | |
/** | |
* Provides Observer interface implementation that is handy for use in data-binding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const RGB_COLOR_REGEX = /\((\d+),\s*(\d+),\s*(\d+)(,\s*(\d*.\d*))?\)/; | |
export class Color { | |
public r: number; | |
public g: number; | |
public b: number; | |
public a: number; | |
constructor() | |
constructor(colorStr?: string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Timer { | |
private _tasks: ITimerTask[] = []; | |
private _enabled = false; | |
register(fn: Function, period: number, dueTime = 0): number { | |
const id = this._tasks.map(t => t.id).reduce((p, c) => p > c ? p : c, 0) + 1; | |
this._tasks.push({ | |
id: id, | |
registerTime: new Date(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'CSV'; | |
def get_ram_usage(pid) | |
output = CSV.parse(`tasklist /FO CSV /V /FI "PID eq #{pid}"`) | |
# Column name is "Mem Usage". Usually it's 5-th column (index 4) | |
col_index = output[0].each_index.select { |i| output[0][i] =~ /mem/i }.first || 4 | |
parse_usage_str output[1][col_index] | |
end | |
def parse_usage_str(str) |