Skip to content

Instantly share code, notes, and snippets.

@harabchuk
harabchuk / array_vs_set.py
Created September 19, 2023 13:12
Compare search in array vs set
import random
import string
import timeit
def generate_random_string(length):
return ''.join(random.choice(string.ascii_letters) for _ in range(length))
random_strings = [
@harabchuk
harabchuk / Dockerfile
Last active January 15, 2021 18:00
Fluentd GELF forwarder
FROM fluent/fluentd:v1.12-debian-1
LABEL Description="Fluentd GELF forwarder"
USER root
RUN gem install fluent-plugin-input-gelf \
&& gem install fluent-plugin-gelf-hs \
&& gem sources --clear-all
COPY ./fluentd.conf /fluentd/etc/
ENV FLUENTD_CONF=fluentd.conf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<button>Click</button>
<script src="https://fb.me/react-with-addons-15.1.0.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<button>Click</button>
<script src="https://fb.me/react-with-addons-15.1.0.js"></script>
@harabchuk
harabchuk / date_add_hours.js
Created May 16, 2015 13:32
Add hours to JavaScript date
Date.prototype.addHours = function(h) {
this.setTime(this.getTime() + (h*60*60*1000));
return this;
}
@harabchuk
harabchuk / datetime_parser.js
Last active August 29, 2015 14:21
Parse and format datetime using smalot/bootstrap-datetimepicker
// requires smalot/bootstrap-datetimepicker
function parse_date(datetime_str, format_str, language_code){
try{
var g = $.fn.datetimepicker.DPGlobal;
var format = g.parseFormat(format_str);
return g.parseDate(datetime_str, format, language_code, 'standard');
}catch(e) {
return false;
}