Skip to content

Instantly share code, notes, and snippets.

@nkirnos
nkirnos / index.html
Created October 20, 2020 06:12
11ty
---
templateEngineOverride: njk
---
<!doctype html>
<html>
<head>
<title>{{page.title}}</title>
</head>
var google_btn = document.querySelector('button[data-provider="google"]')
if(google_btn != null) {
var auth_form = google_btn.closest('form')
auth_form.onsubmit = function() {
const w = 500;
const h = 600;
const left = document.querySelector('._prompt-box-outer').offsetLeft - 100
const top = document.querySelector('._prompt-box-outer').offsetTop - 100
@nkirnos
nkirnos / cors
Created July 8, 2020 12:46
nginx cors
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
@nkirnos
nkirnos / check_load_average.sh
Created March 31, 2020 06:48
power off when low loadaverage
#/bin/bash
load=$(cat /proc/loadavg | awk '{ print $2}')
threshold=0.3
echo $load
check=$(echo "$threshold > $load" | /usr/bin/bc)
if test "$check" = "1"; then
sudo /sbin/shutdown now
fi
window.onzoom = function(e) {
// zoom event
};
// detect resize
(function() {
var oldresize = window.onresize;
window.onresize = function(e) {
var event = window.event || e;
if(typeof(oldresize) === 'function' && !oldresize.call(window, event)) {
$path = storage_path('app/attachments/emails.json');
$items = json_decode(file_get_contents($path),1);
$mapping = [
'question_text' => 'message',
'country' => 'location',
];
$fields = [];
foreach(array_keys($items) as $item_key){
$item = &$items[$item_key];
personaz_my_little_pony MY LITTLE PONY
lego Конструкторы LEGO
novinki_lego_2017 Новинки конструкторов LEGO 2017
lego_classic Классик
lego_juniors Джуниорс
gorod Город
duplo Дупло
zvezdnye_voyny Звездные войны
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Подробные данные об ошибке IIS 10.0 — 405.0 — Method not allowed</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;}
code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;}
.config_source code{font-size:.8em;color:#000000;}
pre{margin:0;font-size:1.4em;word-wrap:break-word;}
```
'function::email_parser' 'Warning [2]: Invalid argument supplied for foreach() в /home/www/SugarCRM/custom/modules/Schedulers/Ext/ScheduledTasks/scheduledtasks.ext.php на линии 2327\n'
'function::missedCallsNotifier' 'Recoverable Error [4096]: Argument 1 passed to MissedCalls\\MissedCallsCommand::findLastRequestByClient() must be an instance of Contact, null given, called in /home/www/SugarCRM/custom/include/MissedCalls/MissedCallsCommand.php on line 57 and defined в /home/www/SugarCRM/custom/include/MissedCalls/MissedCallsCommand.php на линии 181\n'
'function::ReceiveWatcherEmails' 'Warning [2]: Missing argument 1 for Monolog\\Logger::__construct(), called in /home/www/SugarCRM/modules/ssa_Sender/Class/Helper/Task.php on line 230 and defined в /home/www/SugarCRM/vendor/monolog/monolog/src/Monolog/Logger.php на линии 141\nWarning [2]: Missing argument 1 for Monolog\\Logger::__construct(), call
#!/bin/bash
git diff --cached --name-status --diff-filter=ACMR | while read STATUS FILE; do
if [[ "$FILE" =~ ^.+(php|inc)$ ]]; then
php -l "$FILE" 1> /dev/null
if [ $? -ne 0 ]; then
echo "Aborting commit due to files with syntax errors" >&2
exit 1
fi
fi