Skip to content

Instantly share code, notes, and snippets.

View colmdoyle's full-sized avatar

Colm Doyle colmdoyle

View GitHub Profile
@colmdoyle
colmdoyle / page-tab.html
Created July 11, 2012 01:26
really long page tab with auto-grow
<html>
<head>
<title></title>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
<?php
function wp_trim_words( $text, $num_words = 55, $more = null ) {
if ( null === $more )
$more = __( '&hellip;' );
$original_text = $text;
$text = wp_strip_all_tags( $text );
/* translators: If your word count is based on single characters (East Asian characters),
enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */
if ( 'characters' == _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
@colmdoyle
colmdoyle / petition.html
Created July 23, 2012 15:49
Petition OG Example
<!DOCTYPE html>
<html lang="">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# dc-trip: http://ogp.me/ns/fb/dc-trip#">
<title> Petition </title>
<meta property="fb:app_id" content="438840122827431" />
<meta property="og:type" content="dc-trip:petition" />
<meta property="og:url" content="https://colmd.fbdublin.com/dc-trip/petition.php" />
<meta property="og:title" content="Free donuts for all" />
<meta property="og:image" content="http://www.amend2012.org/atf/cf/%7B5457E9EC-EF4A-4F33-BA1B-305FF743FDF9%7D/signthepetition_icon.gif" />
<meta property="og:description" content="We the people, love donuts" />
<html>
<head>
<title></title>
</head>
<body>
<iframe src="http://www.facebook.com/plugins/facepile.php?
app_id=28251678835" scrolling="no" frameborder="0" style="border:none;
overflow:hidden; width:200px;" allowTransparency="true"></iframe>
</body>
</html>
@colmdoyle
colmdoyle / gist:3709424
Created September 12, 2012 19:48
FB Notifications API call
https://graph.facebook.com/<user_id>/notifications?href=/some_url.php&template=testing&access_token=<app_access_token>&method=POST
<script>
if(self == top) {
window.location.replace("http://www.facebook.com/colmstestpage/app_120999667956026");
}
</script>
<?php
if (strlen($instance['title']) > 0) {
echo $before_title.$instance['title'].$after_title;
}
@colmdoyle
colmdoyle / gist:4157347
Created November 27, 2012 21:51
Don't allow other pages to install my tab app.
<?php
$app_secret = 'APPSECRET';
$signed_request = parse_signed_request($_REQUEST['signed_request'], $app_secret);
$page_whitelist = array(PAGEID1, PAGEID2);
if (in_array($signed_request['page']['id'], $page_whitelist)) {
// do stuff
<?php
$content = get_the_content();
$nodes = extract_tags($content, 'h\d+', false);
$headingsList = "";
$currentHeading = 0;
@colmdoyle
colmdoyle / gist:5ac6fc9bcff4a1229ad7
Created December 11, 2014 12:23
irishtechstartups.slack.com Code of Conduct

irishtechstartups.slack.com Code of Conduct