Skip to content

Instantly share code, notes, and snippets.

View gonaumov's full-sized avatar
💭
a status

George Naumov gonaumov

💭
a status
View GitHub Profile
lazy val printBaseDirectory: TaskKey[Unit] = TaskKey[Unit]("printBaseDirectory", "Print baseDirectory for the project", KeyRanks.ATask)
printBaseDirectory := {
Tasks.printBaseDirectory(streams.value, baseDirectory.value)
}
var firstArr = [{someProp: 1},{someProp: 2}];
var secondArr = [{someProp: 2},{someProp: 4}];
var isThereEquals = firstArr.some(function (item) {
return secondArr.some(function (other) {
return other.someProp === item.someProp;
})
});
// this will be true because
// in the both arrays there is
@gonaumov
gonaumov / reverse.js
Last active May 16, 2017 21:13
JavaScripr reverse string one liner
"Пик Бръмбaрът".split("").reduceRight((a,b) => a.concat(b) , '');
// търaбмърБ киП
#include <iostream>
#include <string>
#include <limits>
using namespace std;
#define MINIMUM_SIZE 2
#define MAXIMUM_SIZE 125
void dumpArray(double input[], int inputSize)
@gonaumov
gonaumov / find_bad_revisions
Created July 17, 2017 16:31 — forked from cheeming/find_bad_revisions
A bash script to use git bisect to help bad revisions
#!/bin/bash
function print_usage () {
echo usage: $0 LAST_KNOWN_GOOD_REVISION '"TEST_COMMAND"'
echo LAST_KNOWN_GOOD_REVISION = you can specify this as sha1 hash
echo TEST_COMMAND = the script to run, it should return 0 if success
echo NOTE: Ensure that the current revision is the bad \(broken\)
exit 1;
}
@gonaumov
gonaumov / taskQueue.js
Last active August 2, 2017 13:07
task queue mechanism
this.streamOne = Bacon.fromBinder(function (sink) {
sink(new Bacon.Next());
}).filter(function () {
return sessionStorage.getItem('somethingExist') !== null && sessionStorage.getItem('somethingExist') === 'true';
}).toProperty();
// I noticed that it not works at all when I missed this
// The question is why? :(
this.streamOne.onValue(function () {
sessionStorage.removeItem('somethingExist');
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/ui-lightness/jquery-ui.css" />
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<style type="text/css">
.content .container-project{
border:1px solid blue;
@gonaumov
gonaumov / bash-doc.txt
Last active November 2, 2017 19:34
bash-doc
+ printf 'Shame on me! \nSo far I didn'\''t know about the existence of this package.\nIt contains many example functions and usefull references and can be installed with\nsudo apt-get install bash-doc.\n\n'
Shame on me!
So far I didn't know about the existence of this package.
It contains many example functions and usefull references and can be installed with
sudo apt-get install bash-doc.
+ apt-cache show bash-doc
Package: bash-doc
Architecture: all
Version: 4.3-14ubuntu1.2
// Until now I didn't know about this.
// We can change name of destructed
// variable or function.
const {first: third, second: fourth } = {
first: () => console.log('first'),
second: () => console.log('second')
}
third()
fourth()
@gonaumov
gonaumov / testScript.ps1
Created May 22, 2019 11:30
This is a power-shell script for converting subtitles file to UTF-8 with BOM
foreach($i in Get-ChildItem -Recurse) {
if ($i.PSIsContainer) {
continue
}
$dest = $i.Fullname.Replace($PWD, "converted_files")
if (!(Test-Path $(Split-Path $dest -Parent))) {
New-Item $(Split-Path $dest -Parent) -type Directory
}