Skip to content

Instantly share code, notes, and snippets.

View atomoc's full-sized avatar

Сергей Савельев atomoc

View GitHub Profile
@miguelmota
miguelmota / getDates.js
Last active February 7, 2024 23:43
Get dates in between two dates with JavaScript.
// Returns an array of dates between the two dates
function getDates (startDate, endDate) {
const dates = []
let currentDate = startDate
const addDays = function (days) {
const date = new Date(this.valueOf())
date.setDate(date.getDate() + days)
return date
}
while (currentDate <= endDate) {
@JedWatson
JedWatson / notes.md
Last active February 20, 2020 13:01
Notes on how to create a new field type for Keystone

Creating new Field Types for KeystoneJS

We're currently working on making it easier to add new field types to KeystoneJS as plugins.

In the meantime, if you'd like to work on your own field type, hopefully this guide will point you in the right direction.

Keystone fields require the following:

  • a {fieldType}.js file in ./lib/fieldTypes that controls the field and encapsulates options support, underscore functions, validation and updating
  • the {fieldType}.js file needs to be included by ./lib/fieldTypes/index.js
@AgelxNash
AgelxNash / plugin.LoadElement.php
Last active February 8, 2022 03:39
[MODX Evolution] Плагин загрузки элементов (чанков и сниппетов) из файлов
<?php
/**
* LoadElement
*
* Загрузка элементов из файлов
*
* @version 2.0.0
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
* @category plugin
* @author Agel Nash <modx@agel-nash.ru>
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@Rodrigo54
Rodrigo54 / php-html-css-js-minifier.php
Last active July 12, 2024 10:42 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@MrSwed
MrSwed / plugin.LoadElement.php
Last active March 14, 2017 07:21 — forked from AgelxNash/plugin.LoadElement.php
[MODX Evolution] Плагин загрузки элементов (чанков и сниппетов) из файлов
<?php
if (!defined('MODX_BASE_PATH')) { die('HACK???'); }
/**
* LoadElement
*
* Загрузка чанков и сниппетов из файлов
*
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @author Agel_Nash <modx@agel-nash.ru>
@ckdake
ckdake / .cloudflare
Created July 25, 2016 13:37
helping cloudflare and certbot get along.
CLOUDFLARE_USER=example@example.com
CLOUDFLARE_KEY=probablyshoulduseyourapikeyhereinstead
@leommoore
leommoore / 00.howto_install_phantomjs.md
Last active January 9, 2019 15:38 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 2.1.1

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@krisek
krisek / alert.rules.yml
Last active July 16, 2024 07:49
Prometheus alert rules for node exporter
groups:
- name: node_exporter_alerts
rules:
- alert: Node down
expr: up{job="monitoring-pi"} == 0
for: 2m
labels:
severity: warning
annotations:
title: Node {{ $labels.instance }} is down