Skip to content

Instantly share code, notes, and snippets.

View FrankM1's full-sized avatar
🎯
Focusing

Franklin Gitonga FrankM1

🎯
Focusing
View GitHub Profile
<?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);
/**
* Go to the user list in WordPress, like at
* /wp-admin/network/users.php?orderby=login&order=asc
* Ensure the screen options are set to show all users on the same page.
* Then paste the following into your browser's JavaScript console.
* The list of users will then be output to the clipboard or in an alert.
* This is known to work in Chrome.
*/
(function () {
var current_user_id = prompt("What is your user's ID?", '1'); // @todo Better to automatically determine this
<!--
try at http://jsfiddle.net/westonruter/LVpkf/
note use of autoplay=1 argument so that the video starts playing right away
no IDs are used so multiple instances can appear on the same page
note also that the iframe's width and height are automatically made the same as the original image
this is not ideal because we have potentially duplicate JS in each instance of the image/iframe
-->
<img
src="https://secure-b.vimeocdn.com/ts/283/797/283797216_640.jpg"
data-iframe="http://player.vimeo.com/video/41011190?autoplay=1"
@FrankM1
FrankM1 / Css counter
Created May 9, 2013 10:00
Width depending on number of item present
/* one item */
li:first-child:nth-last-child(1) {
width: 100%;
}
/* two items */
li:first-child:nth-last-child(2),
li:first-child:nth-last-child(2) ~ li {
width: 50%;
}
#navigation .main_menu > ul > li{
/* one item */
&:first-child:nth-last-child(1) {
width: 100%;
}
/* two items */
&:first-child:nth-last-child(2),
&:first-child:nth-last-child(2) ~ li {
@FrankM1
FrankM1 / index.html
Created June 18, 2013 13:10
A CodePen by Franklin Gitonga.
<ul class="projectNavigation">
<li>
<a id="leftButton" href="#">
<div style="">
<!--?xml version="1.0" encoding="utf-8" ?-->
<svg version="1.1"><g transform="rotate(-90 32 32)"><rect x="32" y="26" width="1" height="1" fill="#ffffff"></rect><rect x="31" y="27" width="3" height="1" fill="#ffffff"></rect><rect x="30" y="28" width="5" height="1" fill="#ffffff"></rect><rect x="29" y="29" width="7" height="1" fill="#ffffff"></rect><rect x="32" y="30" width="1" height="1" fill="#ffffff"></rect><rect x="32" y="31" width="1" height="1" fill="#ffffff"></rect><rect x="32" y="33" width="1" height="1" fill="#ffffff"></rect><rect x="32" y="35" width="1" height="1" fill="#ffffff"></rect><rect x="32" y="37" width="1" height="1" fill="#ffffff"></rect></g></svg></div>
</a></li>
<li><a id="topButton" href="#"><div ><!--?xml version="1.0" encoding="utf-8" ?--><svg version="1.1"><g transform="rotate(0 32 32)"><rect x="32" y="26" width="1" height="1" fill="#ffffff"></rect><rect x="31" y="27" widt
@FrankM1
FrankM1 / index.html
Created June 19, 2013 07:44
A CodePen by Franklin Gitonga. Sexy Social Buttons - CSS only animation effect on hover of these simple but fun social buttons.
<a href="http://twitter.com/radiumthemes" class="icon-button twitter"><i class="icon-twitter"></i><span></span></a>
<a href="http://facebook.com" class="icon-button facebook"><i class="icon-facebook"></i><span></span></a>
<a href="http://plus.google.com" class="icon-button google-plus"><i class="icon-google-plus"></i><span></span></a>