Skip to content

Instantly share code, notes, and snippets.

View valentineus's full-sized avatar
🏠
Working from home

Valentin Popov valentineus

🏠
Working from home
View GitHub Profile
"use strict";
function create(total) {
var result = [];
for (var i = 0; i < total; i++) {
result.push(i + 1);
}
return result;
@valentineus
valentineus / file-converter.js
Last active October 2, 2019 11:42
An example of recording and converting to mp3 to ElectronJS.
import ffmpeg from 'fluent-ffmpeg';
import { settings } from '../../../../system';
export default (incomingPatchFile, outgoingPatchFile) => {
const ffmpegPath = settings.get('system.ffmpeg.path', '');
ffmpeg.setFfmpegPath(ffmpegPath);
return new Promise((resolve, reject) => {
@valentineus
valentineus / gist:60eb7344346fe46a42d718f368c72181
Created January 13, 2020 07:36
Kayako starting templates
{% autoescape false %}
{{ contents }}
{{ footer }}
{% endautoescape %}
type SplitString = (value: string, length: number) => string[];
export const splitString: SplitString = (value: string, length: number): string[] => {
const chunks: string[] = [];
for (let index: number = 0; index < value.length; index += length) {
const chunk: string = value.slice(index, index + length);
chunks.push(chunk);
}
@valentineus
valentineus / shell.sh
Created June 1, 2020 10:16
Convert video file to audio file
ffmpeg -i filename.ogg -vn -c:a libopus -ar 16k -ac 1 -b:a 16k -vbr on -compression_level 10 new_filename.ogg
@valentineus
valentineus / cloud9.sh
Created August 15, 2017 00:02
Cloud9 service for the init initialization system.
#!/bin/sh
### BEGIN INIT INFO
# Provides: cloud9
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starting Cloud9 SDK
# Description: Starting the development environment Cloud9 SDK
### END INIT INFO
@valentineus
valentineus / bootstrap.php
Created March 3, 2019 12:21
An example of integration Slim Framework into 1C-Bitrix.
<?php
# local/php_interface/bootstrap.php
declare(strict_types = 1);
define('NOT_CHECK_PERMISSIONS', true);
define('NO_AGENT_CHECK', true);
$_SERVER['DOCUMENT_ROOT'] = dirname(__DIR__, 2);