Skip to content

Instantly share code, notes, and snippets.

View abecoffman's full-sized avatar

Abrahm Coffman abecoffman

View GitHub Profile
@abecoffman
abecoffman / functions.php
Created March 13, 2011 23:21
Adds Facebook SDK to Wordpress
<?php
function facebook_sdk_init() {
wp_enqueue_script('jquery');
// instruction to only load if it is not the admin area
if ( !is_admin() ) {
// register and load the facebook sdk
wp_register_script( 'facebook-sdk',
'http://connect.facebook.net/en_US/all.js',
array(), '', TRUE);
@abecoffman
abecoffman / functions.php
Created March 13, 2011 23:25
Adds Facebook SDK anchor and Namespaces to Wordpress
<?php
function facebook_namespaces($attr) {
$attr .= "\n xmlns=\"http://www.w3.org/1999/xhtml\"";
$attr .= "\n xmlns:og=\"http://opengraphprotocol.org/schema/\"";
$attr .= "\n xmlns:fb=\"http://www.facebook.com/2008/fbml\"";
return $attr;
}
add_filter('language_attributes', 'facebook_namespaces');
@abecoffman
abecoffman / init.facebook.js
Last active September 25, 2015 05:08
Initialize Facebook SDK in Wordpress
window.fbAsyncInit = function() {
FB.init({appId: 'YOUR_APP_ID', status: true,
cookie: true, xfbml: true});
};
@abecoffman
abecoffman / functions.php
Created March 14, 2011 00:06
Adds Facebook Graph meta tags to Wordpress blog pages and thumbnail support to your Wordpress theme
<?php
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
}
function the_facebook_graph_data() {
// setup the default site attributes
$graph;
$graph["site_name"] = "YOUR_SITE_NAME";
@abecoffman
abecoffman / js_subclass_array.js
Created April 20, 2011 06:17
Subclassing arrays in javascript doesn't work as expected
function subArray() {
this.push.apply(this, arguments);
};
subArray.prototype = [];
var sub = new subArray(1,2,3);
alert(sub.length); // 3
@abecoffman
abecoffman / jquery.preload.js
Created November 23, 2011 20:55 — forked from mathiasbynens/jquery.preload.js
JavaScript preload() function
/*!
* $.preload() function for jQuery – http://mths.be/preload
* Preload images, CSS and JavaScript files without executing them
* Script by Stoyan Stefanov – http://www.phpied.com/preload-cssjavascript-without-execution/
* Slightly rewritten by Mathias Bynens – http://mathiasbynens.be/
* Note that since this script relies on jQuery, the preloading process will not start until jQuery has finished loading.
*/
jQuery.preload = function(array) {
var length = array.length,
@abecoffman
abecoffman / wp_sel_posts_by_cat.sql
Created February 23, 2014 02:50
Wordpress: SQL Query Post By Category
SELECT * FROM wp_posts
LEFT JOIN wp_term_relationships ON(wp_posts.ID = wp_term_relationships.object_id)
LEFT JOIN wp_term_taxonomy ON(wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)
LEFT JOIN wp_terms ON(wp_terms.term_id = wp_term_taxonomy.term_id)
WHERE wp_terms.name = 'CATEGORY_NAME'
AND wp_term_taxonomy.taxonomy = 'category'
AND wp_posts.post_status = 'publish'
AND wp_posts.post_type = 'post'

SSL upgrades on rubygems.org and RubyInstaller versions

UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.


Hello,

If you reached this page, means you've hit this SSL error when trying to

@abecoffman
abecoffman / wp_sel_posts_per_tag.sql
Last active August 29, 2015 14:21
Wordpress: SQL Query Count Posts per Tag
SELECT count(*) AS 'TotalCount', wp_terms.name
FROM wp_terms
INNER JOIN wp_term_relationships
ON wp_term_relationships.term_taxonomy_id = wp_terms.term_id
INNER JOIN wp_term_taxonomy
ON wp_term_taxonomy.term_id = wp_terms.term_id AND wp_term_taxonomy.taxonomy = 'post_tag'
GROUP BY wp_terms.name
ORDER BY TotalCount DESC