Skip to content

Instantly share code, notes, and snippets.

View FrankM1's full-sized avatar
🎯
Focusing

Franklin Gitonga FrankM1

🎯
Focusing
View GitHub Profile
{
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/Color Scheme - Default/Tomorrow-Night-Eighties.tmTheme",
"file_exclude_patterns":
[
".DS_Store"
],
"folder_exclude_patterns":
[
"bin",
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
<!--
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"
/**
* 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
/* 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);
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;
<?php
// Filter JPEG compression
add_filter('jpeg_quality', function($arg) { return 100; });
<?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
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
<?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