Skip to content

Instantly share code, notes, and snippets.

@Den2016
Den2016 / imap-attachment.php
Created November 18, 2022 06:30 — forked from hakre/imap-attachment.php
Save attachments from imap messages to disk.
<?php
/**
* imap-attachment.php
*
* @author hakre <hakre.wordpress.com>
* @link http://stackoverflow.com/questions/9974334/how-to-download-mails-attachment-to-a-specific-folder-using-imap-and-php
*/
/**
* Utility Class
@Den2016
Den2016 / gist:f9654cad1e67d40b27bd0bd468abed35
Created November 16, 2021 08:30
Компонент для ввода пароля, который не будет сохранен в Chrome
// в некоторых случаях автосохранение и автоподстановка пароля в гугл хром может быть большой проблемой
// данный компонент позволяет сделать окно авторизации таким, что секюрность ввода пароля будет соблюдена
// и хром не распознает ввод пароля и, соответственно, не будет предлагать его сохранить или использовать
// сохраненный пароль
// использование комплнента очень простое
// в шаблоне <login-pawwsord v-model="mypassword">
// в кодовой части
// components:{
// LoginPassword:()=>import('./login-password')
// }
@Den2016
Den2016 / gist:56f9d5a47056a303b44b899e56065199
Created May 25, 2021 10:14 — forked from neilstuartcraig/gist:6965605
A system V init script for a node JS app (ghost in this case) which uses forever. This script was adapted from a blog post entry by arrow http://ghost.org/forum/installation/295-need-init-script Make sure you amend paths, usernames, descriptions etc. to your app. Also ensure you have installed forever (global installation is simplest via npm ins…
#!/bin/bash
#
# An example init script for running a Node.js process as a service
# using Forever as the process monitor. For more configuration options
# associated with Forever, see: https://github.com/nodejitsu/forever
#
# You will need to set the environment variables noted below to conform to
# your use case, and change the init info comment block.
#
# This was written for Debian distributions such as Ubuntu, but should still
@Den2016
Den2016 / Number2Phrase.js
Created November 17, 2020 04:08 — forked from ba-soft/Number2Phrase.js
Цифры прописью, js
Number.prototype.toPhrase = function (fem, one, two, three, four, five)
// Число прописью от 0 до 999 триллионов
// 100.toPhrase(false, 'чайник', 'чайника', 'чайника', 'чайника', 'чайников')
{
var x = Math.round((this + Number.EPSILON) * 100) / 100;
if (x < 0 || x > 999999999999999.99) return false;
if (fem === undefined) fem = true;
if (!one) one = 'единица';
if (!two) two = 'единицы';
@Den2016
Den2016 / gist:a4cd0f2f2589a923abbbacde4f33a498
Created June 12, 2020 09:31
MySQL stored procedure to generate EAN8
CREATE DEFINER=`root`@`%` FUNCTION `GEN_EAN8`(
`CODE` INT
)
RETURNS vARCHAR(8)
LANGUAGE SQL
NOT DETERMINISTIC
NO SQL
SQL SECURITY DEFINER
COMMENT ''
@Den2016
Den2016 / gist:2b1f6e1badc97bbc58e8e424766fe437
Created June 3, 2020 07:38
MySQL stored function to generate EAN13 from INT
CREATE FUNCTION `GEN_EAN13`(
`CODE` INT
)
RETURNS VARCHAR(13)
LANGUAGE SQL
NOT DETERMINISTIC
NO SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
@Den2016
Den2016 / log.js
Created April 5, 2020 08:06 — forked from vikas5914/log.js
Custom Logger Library with winston
var winston = require('winston')
// set default log level.
var logLevel = 'info'
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'blue',
@Den2016
Den2016 / sendstringasbyteswithlength.js
Created February 27, 2020 08:57
how send string with his length in first 4 bytes via socket in node.js
// Include Nodejs' net module.
const Net = require('net');
// The port number and hostname of the server.
const port = 55555;
const host = 'localhost';
// Create a new TCP client.
const client = new Net.Socket();
@Den2016
Den2016 / toolsmixin.js
Last active January 29, 2020 15:28
deepCopy and generateElementId mixin for Vue.js
export default {
methods: {
/**
* Copying properties of one object to another while maintaining reactivity
*
* @param _from
* @param _to
*/
deepCopy(_from, _to) {
if (Array.isArray(_from)) {