Skip to content

Instantly share code, notes, and snippets.

@tommoor
tommoor / Secure Buffer button.html
Last active December 11, 2015 03:48
Use the following snippet to create a secure Buffer button on HTTPS pages.
<a href="https://bufferapp.com/add" class="buffer-add-button" data-count="vertical">Buffer</a>
<script type="text/javascript" src="https://d389zggrogs7qo.cloudfront.net/js/button.js"></script>
@tommoor
tommoor / Git branches by activity
Created January 16, 2013 12:56
List git branches in reverse order of activity. An easy way to find and delete unused / old branches
for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r
@tommoor
tommoor / mongodb-persist.php
Last active December 11, 2015 10:29
MongoDB persist issue in latest drivers, as this is using the Mongo class rather than MongoClient persist should be ignored rather than throw an exception.
<?php
try {
$connection = new Mongo("mongodb://localhost:27017", array('persist' => 'foo'));
} catch (MongoConnectionException $e) {
print_r($e->getMessage());
}
@tommoor
tommoor / cached.php
Last active December 11, 2015 16:39
Wrapping cache methods in CI
<?php
protected function cached($key, $callback, $life)
{
$this->load->driver('cache', array('adapter' => 'memcached'));
if (!$response = $this->cache->get($key)) {
$response = $callback($this);
if ($response) {
@tommoor
tommoor / response.json
Last active December 12, 2015 05:58
Example PageMunch response v0.1
{
"url": "http:\/\/www.zvents.com\/palmetto_fl\/events\/show\/306476425-nuovo-brides-bridal-expo",
"type": "Event",
"schema": "http:\/\/schema.org\/Event",
"name": "Nuovo Bride's Bridal EXPO at Bradenton Area Convention Center in Palmetto, FL",
"description": "\n\nNuovo Bride's Bridal EXPO\n\n\n\nSunday, Mar 24 12:00p\nto\n4:00p\n\n\n\nBradenton Area Convention Center\nPalmetto,\nFL\n\n\nVisit with 100+ exhibitors, Stroll through cake galleries, Wedding flower galleries, Photography galleries and more! Sample cakes & menus and find your Dream dress. \n\nEnjoy a Runway Fashion Show with all the top local salons. \n\nRegister for giveaways and prizes! Every bride receives a Free Swag Bag. \n\nFree for Brides & Grooms when you register now!\n\n\n",
"image": "http:\/\/www.zvents.com\/dynamic_images\/5\/4\/2\/7\/28237245_184-50x184-50_5.jpg",
"startDate": "2013-03-24T16:00:00Z",
"location": {
"addressLocality": "Palmetto",
@tommoor
tommoor / vimeo.json
Last active December 12, 2015 06:59
PageMunch example response for Vimeo URL
{
"videoQuality": "HD",
"embedUrl": "http:\/\/vimeo.com\/moogaloop.swf?clip_id=58893010",
"duration": "PT00H04M45S",
"width": 720,
"height": 1280,
"playerType": "HTML5 Flash",
"encodingFormat": "MP4",
"uploadDate": "2013-02-04T15:08:24+00:00",
"author": {
@tommoor
tommoor / gist:5183394
Last active December 15, 2015 01:58
How to clone a MediaStream, differences between Chrome 25/26
// works in Chrome 25
try {
this.set({
'stream': stream,
'stream_local': new webkitMediaStream(stream.getAudioTracks(), stream.getVideoTracks())
});
// works in Chrome 26+
} catch(e) {
// This is a test gist that doesn't do anything
(function(){
alert('why are you running this script?');
})();
@tommoor
tommoor / example.html
Created April 11, 2013 19:05
Streams idea
<h1>This gets replaced</h1>
<div class="named true">
This gets shown when condition is met
</div>
<div class="named false">
This gets show otherwise
</div>
@tommoor
tommoor / Sqwiggle 0.1.7
Created May 3, 2013 12:30
Sqwiggle 0.1.7 Release Notes
Added: Ability to mute/unmute audio from command line
Added: Desktop notifications when joining a conversation
Added: Display of users email address to team members display
Added: Clicking anywhere on white share area now focuses, focus area was previously very narrow
Change: linking of @mentions and hashtags to twitter removed
Change: Clicking red cross now closes app rather than hiding
Change: Various performance improvements, memory usage, underlying libs
Fixed: Websocket connections now over SSL by default