Skip to content

Instantly share code, notes, and snippets.

View AramZS's full-sized avatar
🎯
Focusing

Aram Zucker-Scharff AramZS

🎯
Focusing
View GitHub Profile
@AramZS
AramZS / gist:3006740
Created June 27, 2012 20:39
pullquotes!
<div class="pullquote" style="width:150px;float:right;padding:6px;margin-left:6px;margin-right:6px;border-left:1px solid black;font-weight:bold;"> The only downside of the memory system, the STM in particular, is that it can sometimes be too much. The limited inventory encourages some tactical thinking, but when a puzzle is stumping you (and they will stump you) the ability to potentially bring every available object in the game into a conversation can feel overwhelming. </div>​
@AramZS
AramZS / WP_killer_excerpt.php
Created September 5, 2012 12:36
a 'killer' excerpt that allows you to include formatting tags and control the excerpt based on wordcount.
//Set the function up to receive any custom excerpt set by the user.
function a_killer_excerpt( $text ) {
//We'll be using the post object, so we need to call the global object down to play with later.
global $post;
//This if loop makes it so it will only display this modified excerpt if the user hasn't manually set one.
if ( '' == $text ) {
//Get the full content of the post.
$text = get_the_content('');
//Apply all the_content's standard filters.
$text = apply_filters('the_content', $text);
@AramZS
AramZS / bootstrap-tumblr
Last active December 14, 2015 21:08
XKit code to give Tumblr a responsive, fluid, infinitly scrolling, two post column dashboard. Great for big screens.
//* VERSION 1.0 REV A **//
//* TITLE Bootstrap Tumblr **//
//* DESCRIPTION Gives the dashboard 2 responsive columns. Great for wide screens. **//
//* DEVELOPER Aram Zucker-Scharff **//
var jQ = jQuery.noConflict();
jQuery(document).ready(function() {
/**
* jQuery Masonry v2.1.08
* A dynamic layout plugin for jQuery
* The flip-side of CSS Floats
@AramZS
AramZS / zs_find_role_by_capability
Last active February 14, 2017 19:09
Look up WordPress roles by capabilities, instead of having to thread through the role object to check capabilities against every role.
function get_capabilities($cap = false){
# Get the WP_Roles object.
global $wp_roles;
# Set up array for storage.
$role_reversal = array();
# Walk through the roles object by role and get capabilities.
foreach ($wp_roles->roles as $role_slug=>$role_set){
foreach ($role_set['capabilities'] as $capability=>$cap_bool){
# Don't store a capability if it is false for the role (though none are).
@AramZS
AramZS / gist:5923140
Last active December 19, 2015 08:08
Social media buttons for WordPress
<?php
?>
<script async src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="<?php the_permalink(); ?>" show_faces="false" width="349" action="recommend" data-colorscheme="light" font=""></fb:like>
<a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink(); ?>" data-text="<?php the_title(); ?>" data-count="horizontal" data-via="Chronotope">Tweet</a><script async type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<su:badge layout="2" location="<?php the_permalink(); ?>"></su:badge>
<g:plusone size="medium" href="<?php the_permalink(); ?>"></g:plusone>
@AramZS
AramZS / sidebar-for-anyone
Last active December 20, 2015 11:19
Quick and dirty universal sidebar HTML
<div class="quick-sidebar" style="width:100px; height:auto; float:right; margin-right: 10px; margin-left: 10px; margin-top: 10px; margin-bottom: 10px; border: 1px solid black; padding: 6px;">
Your content goes in here. It can be images, words, video, or anything.
All the numbers to control how this are contained inside the style attribute above.
Width and height are for size control. Leave out height and the box will get as long as you need it to be to contain text.
You must set a width.
Float controls if it sits on the right or left side of the page.
The margins control the amount of empty space that sits on the side of the sidebar designated after the hyphan.
Border controls the border size, line type, and color.
Basic color names can be found at http://www.w3schools.com/html/html_colornames.asp
And here are the border styles - http://www.w3schools.com/css/css_border.asp
@AramZS
AramZS / Post related objects
Last active December 31, 2015 16:09
WordPress Objects
<?php
/**
* Tag
object(stdClass)#427 (9) {
["term_id"]=>
string(2) "18"
["name"]=>
string(4) "test"
["slug"]=>
string(4) "test"
@AramZS
AramZS / shareCount.php
Last active August 29, 2015 13:56
PHP Sharecount
<?php
class shareCount {
private $url,$timeout;
function __construct($url,$timeout=30) {
$this->url=rawurlencode($url);
$this->timeout=$timeout;
}
function get_tweets() {
$json_string = $this->file_get_contents_curl('http://urls.api.twitter.com/1/urls/count.json?url=' . $this->url);
$json = json_decode($json_string, true);
@AramZS
AramZS / gAnalytics-template-tag.php
Last active August 29, 2015 13:56
A quick WordPress template tag to create Google Analytics Event Tracking on links. Built on behalf of CFO Publishing.
<?php
/**
* Get a safe string for custom variables or event tracking for Google Analytics.
*/
function get_for_google_analytics($string){
$string = strip_tags($string);
$string = remove_accents( html_entity_decode($string) );
$safe_string = esc_js( $string );
return $safe_string;
}
@AramZS
AramZS / modrewritetest.php
Created March 10, 2014 22:58
For testing if mod_rewrite is enabled.
<?php
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Check for mod_rewrite</title></head>
<body>
Test: