Skip to content

Instantly share code, notes, and snippets.

@bMinaise
bMinaise / getgallerywordpress
Created September 6, 2013 01:36
Wordpress Get Galleries
$gallery = get_post_gallery( $post, false );
$ids = explode( ",", $gallery['ids'] );
foreach( $ids as $id ) {
$link = wp_get_attachment_url( $id );
$image = wp_get_attachment_image( $id, "thumbnail");
echo( "<div class='item'><a href='$link'>" . $image . "</a></div>" );
}
@bMinaise
bMinaise / PHP Console Output
Created September 5, 2013 18:25
Output PHP data in console
<?php
/**
* Send debug code to the Javascript console
*/
function debug_to_console($data) {
if(is_array($data) || is_object($data))
{
echo("<script>console.log('PHP: ".json_encode($data)."');</script>");
} else {
echo("<script>console.log('PHP: ".$data."');</script>");
@bMinaise
bMinaise / Boilerplate CSS Media Queries
Created September 5, 2013 18:17
CSS Media Queries Boilerplate
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-width : 320px)
and (max-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@bMinaise
bMinaise / Media Queries Bootstrap
Created September 5, 2013 18:15
Bootstrap 3 - Media Queries LESS
/* Extra small devices (phones, up to 480px) */
/* No media query since this is the default in Bootstrap */
/* Small devices (tablets, 768px and up) */
@media (min-width: @screen-sm) { ... }
/* Medium devices (desktops, 992px and up) */
@media (min-width: @screen-md) { ... }
/* Large devices (large desktops, 1200px and up) */
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};