This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get YouTube ID from various YouTube URL | |
* @author: takien | |
* @url: http://takien.com | |
* For PHP YouTube parser, go here http://takien.com/864 | |
*/ | |
function YouTubeGetID(url){ | |
var ID = ''; | |
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This is the cleaner code per request of a thread in the LinkedIn group "WordPress" | |
// ... | |
// register and enqueue loadCSS | |
function load_scripts_and_styles() { | |
// register loadCSS | |
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.img-container { | |
position: relative; | |
padding-bottom: 56.25%; /* 16:9 ratio */ | |
height: 0; | |
overflow: hidden; | |
} | |
.img-container img { | |
position: absolute; | |
top: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inline SVG code images in LESS CSS | |
// @author Matt Scheurich <[email protected]> (http://lvl99.com) | |
// Github: https://github.com/lvl99/less-inline-svg-code | |
.inline-svg-code( @code ) { | |
@-svg-code: escape(~'<?xml version="1.0" ?>@{code}'); | |
@-inline-svg-code: ~'data:image/svg+xml,@{-svg-code}'; | |
@-inline-svg-url: ~"url('@{-inline-svg-code}')"; | |
} | |
// Basic Example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get Youtube URL | |
$yturl = 'https://www.youtube.com/watch?v=HhAKNSsb4t4'; | |
preg_match("/^(?:http(?:s)?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/))([^\?&\"'>]+)/", $yturl, $matches); | |
$video_id = $matches[1]; | |
// Get Thumbnail | |
$file_headers = get_headers( 'http://img.youtube.com/vi/' . $video_id . '/maxresdefault.jpg' ); | |
$is_404 = $file_headers[0] == 'HTTP/1.0 404 Not Found' || false !== strpos( $file_headers[0], '404 Not Found' ); | |
$video_thumbnail_url = $is_404 ? 'http://img.youtube.com/vi/' . $youtube_id . '/maxresdefault.jpg' : 'http://img.youtube.com/vi/' . $video_id . '/hqdefault.jpg'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// other stuff ... | |
// register our filter to the wordpress action 'the_content', | |
// it will then be called when we call the_content() from anywhere in our template | |
add_filter( 'the_content', 'add_classlist_to_img' ); | |
function add_classlist_to_img( $content ) { | |
// used to detect img tag element | |
$locateElement = '/\<img.*?\/\>/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- // The HTML (could be part of page content) // --> | |
<input type="text" name="keyword" id="keyword" onkeyup="fetch()"></input> | |
<div id="datafetch">Search results will appear here</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Replacing SVG strings in data-uri style situations | |
* by Jakob Erikson -- https://github.com/jakob-e | |
* | |
* http://codepen.io/jakob-e/pen/doMoML | |
*/ | |
// Function to replace characters in a string | |
@function str-replace($string, $search, $replace: '') { | |
$index: str-index($string, $search); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir ~/bin | |
mkdir ~/bin/wp-cli | |
cd ~/bin/wp-cli | |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
chmod +x wp-cli.phar | |
echo "export COLUMNS" >> ~/.bashrc | |
echo "alias wp='php ~/bin/wp-cli/wp-cli.phar'" >> ~/.bashrc | |
echo "alias php='/usr/bin/php'" >> ~/.bashrc | |
source ~/.bashrc | |
echo "PATH=$HOME/bin:$PATH" >> ~/.bashrc |
OlderNewer