Skip to content

Instantly share code, notes, and snippets.

View vladimirlukyanov's full-sized avatar
🗯️
It's during our darkest moments that we must focus to see the light

Vladimir Lukyanov vladimirlukyanov

🗯️
It's during our darkest moments that we must focus to see the light
View GitHub Profile
@vladimirlukyanov
vladimirlukyanov / Parallax.js
Last active August 29, 2015 14:03
Parallax
$('.parallax').each(function () {
var bgobj = $(this).find('.bg'); // создаем объект
$(window).scroll(function () {
var yPos = -($(window).scrollTop() / bgobj.data('speed')); // вычисляем коэффициент
// Присваиваем значение background-position
var coords = 'center ' + yPos + 'px';
// Создаем эффект Parallax Scrolling
bgobj.css({ backgroundPosition: coords });
});
@vladimirlukyanov
vladimirlukyanov / simple_rss_parser.php
Created September 12, 2014 17:50
Simple RSS parser
<?php
$i = 0; // counter
$url = "http://www.banki.ru/xml/news.rss"; // url to parse
$rss = simplexml_load_file($url); // XML parser
// RSS items loop
print '<h2><img style="vertical-align: middle;" src="'.$rss->channel->image->url.'" /> '.$rss->channel->title.'</h2>'; // channel title + img with src
@vladimirlukyanov
vladimirlukyanov / Add_Spaces_to_Dock.txt
Last active August 29, 2015 14:08
[OS X] Add Spaces to Dock
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
killall Dock
@vladimirlukyanov
vladimirlukyanov / unexpected_output.php
Created December 10, 2014 07:19
The plugin generated x characters of unexpected output
<?php
add_action('activated_plugin','my_save_error');
function my_save_error()
{
file_put_contents(dirname(__file__).'/error_activation.txt', ob_get_contents());
}
@vladimirlukyanov
vladimirlukyanov / woo_cat_featured_image.php
Created January 17, 2015 02:31
WooCommerce category featured image display
@vladimirlukyanov
vladimirlukyanov / docker_remove_all.sh
Created January 31, 2015 21:09
docker remove all
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
<?php
$args = array(
//////Author Parameters - Show posts associated with certain author.
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters
'author' => '1,2,3', //(int) - use author id [use minus (-) to exclude authors by ID ex. 'author' => '-1,-2,-3,']
'author_name' => 'luetkemj', //(string) - use 'user_nicename' (NOT name)
'author__in' => array(2, 6), //(array) - use author id (available with Version 3.7).
'author__not_in' => array(2, 6), //(array)' - use author id (available with Version 3.7).
@vladimirlukyanov
vladimirlukyanov / Rectangular_to_square_js_photoshop.js
Created May 1, 2015 23:58
Rectangular_to_square_js_photoshop.js
var inputFolder = Folder.selectDialog("Select a folder to process");
var fileList = inputFolder.getFiles("*.jpg");
for(var i=0; i<fileList.length; i++) {
var doc = open(fileList[i]);
if (doc.width !== doc.height) { // if document is not already square...
if (doc.width > doc.height) { // if width is greater...
doc.resizeCanvas(doc.width, doc.width) // use this value for both sides...
} else { // else use height for both sides...
@vladimirlukyanov
vladimirlukyanov / php_email_test.php
Created May 21, 2015 23:44
PHP email testing | Test sendmail postfix PHP
<?php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "__email__";
$to = "__email__";
$subject = "PHP Mail Test script";
$message = "This is a test to check the PHP Mail functionality";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
echo "Test email sent";
@vladimirlukyanov
vladimirlukyanov / WordPress_loop.php
Created July 31, 2015 06:38
WordPress default loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
the_title();
the_content();
?>
<?php endwhile; ?>
<?php endif; ?>