Skip to content

Instantly share code, notes, and snippets.

@polis89
polis89 / SimplePreloader
Last active March 13, 2017 17:07 — forked from akanastorm/SimplePreloader
Simple Preloader by agragregra
#loader {
background: none repeat scroll 0 0 #ffffff;
bottom: 0;
height: 100%;
left: 0;
position: fixed;
right: 0;
top: 0;
width: 100%;
z-index: 9999;
@polis89
polis89 / wp_query.php
Last active March 19, 2017 11:10
WordPress query_posts
<?php if( have_posts() ) : query_posts("p=1");
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php if( has_post_thumbnail(); ) : ?>
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
@polis89
polis89 / common.js
Last active March 22, 2017 13:59
Call form JS+PHP+css+html
//Fancybox callform
$('#menu_phone, #menu_phone_2').fancybox({
'padding': 37,
'margin': 20,
'overlayOpacity': 0.87,
'overlayColor': '#fff',
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'titlePosition': 'inside',
'centerOnScroll': true
Keymap (Windows Users):
[
{ "keys": ["alt+shift+f"], "command": "reindent" },
]
Settings:
{
"show_definitions": false,
"auto_complete": false,
"bold_folder_labels": true,
@polis89
polis89 / fonts_load.js
Created April 20, 2017 16:15
Load fonts in browser local storage
<script>!function(){function e(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}function t(e){return window.localStorage&&localStorage.font_css_cache&&localStorage.font_css_cache_file===e}function n(){if(window.localStorage&&window.XMLHttpRequest)if(t(o))a(localStorage.font_css_cache);else{var n=new XMLHttpRequest;n.open("GET",o,!0),e(n,"load",function(){4===n.readyState&&(a(n.responseText),localStorage.font_css_cache=n.responseText,localStorage.font_css_cache_file=o)}),n.send()}else{var c=document.createElement("link");c.href=o,c.rel="stylesheet",c.type="text/css",document.getElementsByTagName("head")[0].appendChild(c),document.cookie="font_css_cache"}}function a(e){var t=document.createElement("style");t.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(t)}var o="_fonts.css";window.localStorage&&localStorage.font_css_cache||document.cookie.indexOf("font_css_cache")>-1?n():e(window,"load",n)}();</script>
@polis89
polis89 / functions.php
Created May 1, 2017 13:25
SettingsPage in WP
<?php include_once('options_page.php');?>
@polis89
polis89 / checkform.js
Created May 17, 2017 09:27
Check form fields and redirect to php script
$('#pdf_form').ajaxForm({
url: "/wp-content/themes/serf/send_file.php",
method: "POST",
beforeSubmit: function(data, $form) {
var $name = $form.find(".js-in-name"),
$phone = $form.find(".js-in-phone"),
$mail = $form.find(".js-in-mail");
printValid($name);
@polis89
polis89 / scroll.js
Created May 27, 2017 12:07
Smooth scroll to id
$(document).ready(function() {
$('a[href*=#]').on('click', function(e) {
e.preventDefault();
var target = $(this).attr("href");
$('html, body').stop().animate({ scrollTop: $(target).offset().top}, 500, function() {
location.hash = target;
});
return false;
});
});
@polis89
polis89 / form.html
Created June 2, 2017 19:19
Contact Form form markup
<div role="form" class="wpcf7" id="wpcf7-f4-o1" lang="en-US" dir="ltr">
<div class="screen-reader-response"></div>
<form action="/food/#wpcf7-f4-o1" method="post" class="wpcf7-form" novalidate="novalidate">
<div style="display: none;">
<input type="hidden" name="_wpcf7" value="4" />
<input type="hidden" name="_wpcf7_version" value="4.7" />
<input type="hidden" name="_wpcf7_locale" value="en_US" />
<input type="hidden" name="_wpcf7_unit_tag" value="wpcf7-f4-o1" />
<input type="hidden" name="_wpnonce" value="648a975fd6" />
</div>
@polis89
polis89 / com.sh
Last active November 8, 2017 14:25
Copy LP
wget -r -k -l 7 -p -E -nc http://site.com/