Skip to content

Instantly share code, notes, and snippets.

View thomas-gordon's full-sized avatar

Thomas Gordon thomas-gordon

  • Squareweave
  • Melbourne, Australia
View GitHub Profile
@thomas-gordon
thomas-gordon / jQuery accordion
Created June 27, 2013 00:02
relies on the traditional #accordion>h2+div structure.
jQuery(function () {
var Accordion = {
init: function (targetContainer) {
var _self = this;
this.accordion = jQuery(targetContainer);
this.details = this.accordion.find('div');
this.details.hide();
this.accordion.on('click', 'h2', function () { _self.show(this) } )
},
@thomas-gordon
thomas-gordon / facebook-tab-app-like-gate.php
Created May 29, 2013 00:33
Like gating with the fairly dead 'facebook tab app' technology is really simple. If you include this script on the index file of your tab app page, you can grab whether the tab app's parent page is liked by the user or not.
<?php
$signed_request=$_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if ($data['page']['liked'] == '1') { ?>
<p>You like it!</p>
<?php } else { ?>
<p>You don't like it!</p>
<? } ?>
@thomas-gordon
thomas-gordon / Git Multi Repo Update
Created November 11, 2012 23:52
Git pulls each repo inside a given parent folder. Useful if you store a folder full of separate repos.
find . -type d -d 1 -exec echo git --git-dir={}/.git --work-tree=$PWD/{} status \;
@thomas-gordon
thomas-gordon / Css triangles mixin
Created October 9, 2012 05:12
SCSS mixin for css triangles.
@mixin css-triangle($direction:'left',$size:5px, $color:$black) {
width: 0;
height: 0;
position:absolute;
content: " ";
left:0;
top:0;
@if $direction == 'left' {
border-top: $size solid transparent;