Skip to content

Instantly share code, notes, and snippets.

Avatar

Ivan Burlakov iburlakov

  • Russian Wizards
  • Taganrog, Russia
View GitHub Profile
View ispal.js
function isPalindrome(str) {
if (!str) return false;
let i = 0;
do {
if (str[i] != str[str.length - 1 - i]) {
return false;
}
i++;
}while(i < str.length - i);
View ones.js
// calculate the number of "ones" on tan integer
function calculate(num) {
let count = 0;
do {
count += num & 1;
num = num >> 1;
} while (num);
return count;
@iburlakov
iburlakov / docker-help.md
Created Jan 24, 2019 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips
View docker-help.md

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@iburlakov
iburlakov / hackerrank-quicksort.cs
Created Oct 11, 2016
Quicksort in-place implementation in c#
View hackerrank-quicksort.cs
int partition(int[] arr, int si, int ei)
{
var pivot = arr[ei];
var pivotIndex = si;
for (var i = si; i < ei; i++)
{
// swap if current is lesser than pivot
if (arr[i] < pivot)
{
var t = arr[pivotIndex];
@iburlakov
iburlakov / mass-iconutil.sh
Created Apr 18, 2016
Batch convert icns/iconset
View mass-iconutil.sh
#!/bin/bash
DIR=$1
FORMAT=$2
FILES=$DIR/*
for file in $FILES
do
filename="${file##*/}"
name="${filename%.*}"
@iburlakov
iburlakov / TaskLauncher.h
Last active Dec 11, 2015
nstask output 2 console
View TaskLauncher.h
//
// TaskLauncher.h
// sandbox-nstask
//
// Created by Ivan Burlakov on 11/12/15.
// Copyright © 2015 Ivan Burlakov. All rights reserved.
//
#import <Foundation/Foundation.h>
@iburlakov
iburlakov / calc.js
Created Nov 25, 2015
Calculate amount of 1 digits in given number
View calc.js
// calculate amount of 1 digits in given number
function calc(num) {
var digits = 0;
do {
if (num & 1) {
digits++;
}
num = num >>> 1
} while (num != 0);
@iburlakov
iburlakov / DomainInfo.m
Created Oct 9, 2014
Get domain name from dsconfigad
View DomainInfo.m
NSString *
getDomainName() {
// "dsconfigad --show" command returns domain which mac joined to or nothing if mac is not joined to any domain
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/usr/sbin/dsconfigad"];
[task setArguments: [NSArray arrayWithObjects:@"--show", nil]];
NSPipe *pipe = [NSPipe pipe];
[task setStandardOutput: pipe];
@iburlakov
iburlakov / CalloutBorder.cs
Created Dec 11, 2013
A sample of inherit from Decorator class. CalloutBorder wraps content with custom shape border, parameters of pointer are customizable. Sample is also attached.
View CalloutBorder.cs
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace iburlakov
{
public class CalloutBorder : Decorator
{
private const double DEFAULT_POINTER_HEIGTH = 20D;
private const double DEFAULT_POINTER_WIDTH = 10D;
@iburlakov
iburlakov / MainWindow.xaml
Created Jul 17, 2013
How to show custom template for ListView when it has no items to show.
View MainWindow.xaml
<Window x:Class="TabControlExp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
You can’t perform that action at this time.