Skip to content

Instantly share code, notes, and snippets.

View viatsko's full-sized avatar

Valerii Iatsko viatsko

  • Google
  • Zurich, Switzerland
  • 21:18 (UTC +02:00)
View GitHub Profile
@viatsko
viatsko / recurse-case-insensitive.ps1
Created June 13, 2019 06:34
Recursive Case Insensitive PowerShell
(Get-ChildItem -Recurse -Directory).FullName | ForEach-Object {fsutil.exe file setCaseSensitiveInfo $_ enable}
@viatsko
viatsko / parse-ruby-sd-hash.java
Created October 22, 2017 21:01
Parsing ruby single-dimension hash from java
import java.util.Map;
import java.util.HashMap;
public class ConvertRubySDHash {
public static Map<String, String> convertToObject(String line) {
Map<String, String> result = new HashMap<>();
for (int i = 0; i < line.length(); i++) {
while(i < line.length()) {
if (line.charAt(i) == '=' && line.charAt(i + 1) == '>') {
@viatsko
viatsko / log-reader.js
Created August 27, 2017 22:42
Node.JS - reading log line-by-line
// https://stackoverflow.com/a/23695940/844204
var fs = require('fs')
, util = require('util')
, stream = require('stream')
, es = require('event-stream');
var lineNr = 0;
var s = fs.createReadStream('very-large-file.csv')
@viatsko
viatsko / ExportKindle.js
Created August 27, 2017 16:05 — forked from jkubecki/ExportKindle.js
Amazon Kindle Export
// The following data should be run in the console while viewing the page https://read.amazon.com/
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension
var db = openDatabase('K4W', '2', 'thedatabase', 1024 * 1024);
getAmazonCsv = function() {
// Set header for CSV export line - change this if you change the fields used
var csvData = "ASIN,Title,Authors,PurchaseDate\n";
db.transaction(function(tx) {
@viatsko
viatsko / keybase.md
Created August 7, 2017 18:04
keybase.md

Keybase proof

I hereby claim:

  • I am viatsko on github.
  • I am viatsko (https://keybase.io/viatsko) on keybase.
  • I have a public key ASCv3OujDvgf83tDamhNfzciDroGiCK1aYqkJfYDXmd0eQo

To claim this, I am signing this object:

Hotel's Catalog & Hotel's Page:
* Can't see price for 1 day if didn't select date on previous page, only $$$$$ instead of it on hotel description. Booking suggests to select date via select area which is not comfortable to see price just for one night. Need to find a place for daily buttons.
* Maybe give user an ability to save search filter in case he has some hotel requirements or just want to keep different filters for work travel/family travel, I, myself, find it very useful for me.
http://www.booking.com/hotel/fr/poussins.ru.html?sid=d3db3da5dfd91caf15a630553a89cb24;dcid=4;checkin=2015-06-15;checkout=2015-06-16;dist=0;srfid=4a5feaf12beee7bd0fdd20e26f4ac574abc93882X1;type=total;ucfs=1&
* Visitors also seen needs fancybox gallery to preview hotel photos, it would be more catchy than just random photo on hover (even if it's not a random photo)
var _ = require('lodash');
var data = require('./entries.json');
module.exports = _.map(data, function(){
data.summ = data.summ * 2;
return data;
});
@viatsko
viatsko / djs.js
Last active August 12, 2019 13:01
djs
var waveform = require('waveform');
var fs = require('fs');
var probe = require('node-ffprobe');
var _ = require('lodash');
var async = require('async');
var walk = require('walk');
var files = [];
// Walker options
@viatsko
viatsko / gist:4a341368eb4fc1a95704
Created August 31, 2014 19:08
Чек на расширение картинки в js
if (!filename.match(/(jpe?g|png|gif)$/)){
}
@viatsko
viatsko / gist:866c8a32d4bdd43d1f46
Created August 31, 2014 08:54
Транслит, не помню откуда
'use strict';
module.exports = function(text) {
return text.replace(/([а-яё])|([\s_-])|([^a-z\d])/gi,
function (all, ch, space, words, i) {
if (space || words) {
return space ? '-' : '';
}
var code = ch.charCodeAt(0),
index = code == 1025 || code == 1105 ? 0 :