Skip to content

Instantly share code, notes, and snippets.

@onionstand
onionstand / install-configure-letsencrypt.sh
Created June 5, 2020 11:22 — forked from craigvantonder/install-configure-letsencrypt.md
Install and configure LetsEncrypt on Ubuntu Server 14.04 & 16.04 (Apache)
#!/bin/bash
# https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-14-04
# Download the Let’s Encrypt Client
cd /usr/local/sbin
sudo wget https://dl.eff.org/certbot-auto
sudo chmod a+x /usr/local/sbin/certbot-auto
# Set Up the SSL Certificate
@onionstand
onionstand / PHP.sublime-settings
Created October 28, 2018 20:06
configure Sublime Text for PSR Standards
{
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"rulers":
[
80,
120
],
"tab_size": 4,
"translate_tabs_to_spaces": true,
@onionstand
onionstand / .htaccess
Created October 23, 2018 18:12 — forked from vielhuber/.htaccess
Apache: htaccess force www and https ssl #server
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
# alternative way
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
// implementation of disabled form fields
var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
var checkin = $('#dpd1').fdatepicker({
onRender: function (date) {
return date.valueOf() < now.valueOf() ? 'disabled' : '';
}
}).on('changeDate', function (ev) {
if(ev.date){
if (ev.date.valueOf() > checkout.date.valueOf()) {
@onionstand
onionstand / clean-for-mail.php
Last active February 1, 2017 22:28
Clean string for php mail function
<?php
function cleanForMail($str_for_mail) {
$val=trim(stripslashes(strip_tags($str_for_mail)));
$pattern = '/[\r\n]|Content-Type:|Bcc:|Cc:/i';
if (preg_match($pattern, $val)){
$val = NULL;
}
return $val;
}
@onionstand
onionstand / sef-url.js
Last active September 10, 2016 20:51
SEF url od ćirilice
function genSEF(from,to) {
var str = from.value.toLowerCase();
str = str.replace(/љ/g,'lj');
str = str.replace(/Љ/g,'Lj');
str = str.replace(/њ/g,'nj');
str = str.replace(/Њ/g,'Nj');
str = str.replace(/џ/g,'dž');
str = str.replace(/Џ/g,'Dž');
str = str.replace(/а/g,'a');