Skip to content

Instantly share code, notes, and snippets.

@slavapas
slavapas / .htaccess
Created January 27, 2016 07:01 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
{
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "lighten(#000, 20%)",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 60%)",
"@gray-lighter": "lighten(#000, 93.5%)",
"@brand-primary": "#428bca",
"@brand-success": "#5cb85c",
"@brand-info": "#5bc0de",
@slavapas
slavapas / Stylus PX to REM Mixin
Created January 5, 2017 07:55 — forked from gearmobile/Stylus PX to REM Mixin
Stylus PX to REM Mixin
set-font-size(value) {
font-size: value; /* добавляем PX как подстраховку */
if (value is inherit) {
/* делаем если нет значения для шрифта */
} else {
font-size: remify(value);
}
}
Keymap (Windows Users):
[
{ "keys": ["alt+shift+f"], "command": "reindent" },
]
Settings:
{
"show_definitions": false,
"auto_complete": false,
"bold_folder_labels": true,
@slavapas
slavapas / form_submit_no_reload.js
Created March 21, 2017 12:58
form submit ajax no reload
$('#reg-form').submit(function(e){
e.preventDefault(); // Prevent Default Submission
$('form :submit').prop('disabled', true); // disable submit button
$.ajax({
// ajax source
})
.done(function(data){
$('form :submit').prop('disabled', false); // enable submit button
})
.fail(function(){
@slavapas
slavapas / php_mail()
Created March 21, 2017 19:27
php email code
<?php
$to = "mail@yourdomain.com";
$from = $_REQUEST['email'];
$name = $_REQUEST['name'];
$headers = "From: $from";
$subject = "You have a message sent from your site";
$fields = array();
$fields{"name"} = "name";
$fields{"email"} = "email";
$fields{"phone"} = "phone";
@slavapas
slavapas / js+php+html_complete_contact_form
Last active March 21, 2017 21:25
js+php+html_complete_contact_form
/-----------------FORM--------------------------------------------------------------------------------------------------
<div id="form-content">
<form method="post" id="reg-form" autocomplete="off" onsubmit="document.getElementById('myButton').disabled=true; document.getElementById('myButton').value='Submitting, please wait...';"; >
<div class="form-group">
<input type="text" class="form-control" name="txt_fullname" id="lname" placeholder="Full Name" required />
</div>
@slavapas
slavapas / Simple Contact form using Jquery Ajax & PHP
Last active February 15, 2019 12:39
Simple Contact form using Jquery Ajax & PHP.html
Simple Contact form using Jquery Ajax & PHP
http://www.otallu.com/tutorials/simple-contact-form-using-jquery-ajax-php/
-----------------------------------------------------
HTML
-----------------------------------------------------
<form method="post" class="myform" action="process-form.php">
<input type="text" name="name" placeholder="Your Name" required><br>
<input type="email" name="email" placeholder="Your Email" required><br>
<textarea rows="4" cols="20" name="message" placeholder="Your Message"></textarea><br>
<input type="submit" name="send" value="Send"> <span class="output_message"></span>
@slavapas
slavapas / How to hide dropdown menu on click outside of the element in jQuery
Created March 29, 2017 13:01
How to hide dropdown menu on click outside of the element in jQuery
$(document).on("click", function(event){
var $trigger = $(".dropdown");
if($trigger !== event.target && !$trigger.has(event.target).length){
$(".dropdown-menu").slideUp("fast");
}
});