Skip to content

Instantly share code, notes, and snippets.

@bMinaise
bMinaise / designer.html
Last active August 29, 2015 14:16
designer
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-app.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};
@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) */
@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 / 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 / gallery-query.php
Created September 11, 2013 17:14
Wordpress Category Query
public static function get_form_summary(){
global $wpdb;
$form_table_name = self::get_form_table_name();
$lead_table_name = self::get_lead_table_name();
$sql = "SELECT l.form_id, count(l.id) as unread_count
FROM $lead_table_name l
WHERE is_read=0 AND status='active'
GROUP BY form_id";
@bMinaise
bMinaise / show-gallery-urls.php
Created September 26, 2013 00:45
Get Gallery Image URLs Sample plugin illustrating how to retrieve all image URLs of gallery images in a post Author: Pippin Williamson
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
<?php
/* Determining the domain - DO NOT EDIT */
$host = $HTTP_HOST;
$parts = explode('.',$host);
if ($parts[3] = "") {
$domain = $parts[0];
} else {
$domain = $parts[1];