Skip to content

Instantly share code, notes, and snippets.

View FrankM1's full-sized avatar
🎯
Focusing

Franklin Gitonga FrankM1

🎯
Focusing
View GitHub Profile
<?php
/*
Plugin Name: Test
*/
class My_Like_Button {
function __construct()
{
$this->hooks();
}
@FrankM1
FrankM1 / jquery.slider.css
Created August 2, 2012 03:11 — forked from lukemorton/jquery.slider.css
slider tutorial
.slider-container {
width: 600px;
height: 200px;
overflow: hidden;
position: relative;
}
.slider ul, .slider li {
margin: 0;
padding: 0;
list-style: none;
@FrankM1
FrankM1 / wysiwyg.css
Created August 10, 2012 11:25
WYSIWYG styles for WordPress editor. Displays the elements classname next to each element
body *[class] {
position:relative;
border:1px dashed #ccc;
}
body *[class]::before {
content:attr(class);
line-height:10px;
color:#fff;
font-size:9px;
font-family:sans-serif;
@FrankM1
FrankM1 / smooth_sortable_animating.html
Created November 1, 2012 22:25 — forked from chrisdickinson/smooth_sortable_animating.html
smoothly animate jquery sortable lists.
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
ul { float:left; margin-right:20px; }
body { color:white; font-family:Helvetica, sans-serif; text-shadow:1px 1px 1px rgba(0,0,0,0.2); }
ul { width:512px; overflow:hidden; border-radius:6px; }
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|",array("col","shortcode2","shortcode3"));
// opening tag
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
<?php
// Here we are, in any scope imaginable. It doesn't matter which
$my_object = new My_Class();
add_filter( 'jpb.provider.my_class', function() use ( $my_object ) {
return $my_object || new My_Class();
} );
// This is in the global scope
<?php
// Filter JPEG compression
add_filter('jpeg_quality', function($arg) { return 100; });
backend default {
.host = "127.0.0.1";
.port = "8444";
}
sub vcl_recv {
# Allow the back-end to serve up stale content if it is responding slowly.
set req.grace = 2m;
/* In functions.php */
function my_theme_get_post_format_image_src($post_id){
$format_meta = get_post_format_meta($post_id);
$match = array();
preg_match('/<img.*?src="([^"]+)"/s', $format_meta['image'], $match);
return $match[1];
}
/* In the template file */
$image_src = my_theme_get_post_format_image_src($post->ID);