Skip to content

Instantly share code, notes, and snippets.

View bretterer's full-sized avatar

Brian Retterer bretterer

View GitHub Profile
@bretterer
bretterer / Toggle Button Class
Last active March 11, 2016 09:51
Toggle twitter bootstrap button classes.
$('.btn-group > .btn, .btn[data-toggle="button"]').click(function() {
var buttonClasses = ['btn-primary','btn-danger','btn-warning','btn-success','btn-info','btn-inverse'];
var $this = $(this);
if ($(this).attr('class-toggle') != undefined && !$(this).hasClass('disabled')) {
var btnGroup = $this.parent('.btn-group');
var btnToggleClass = $this.attr('class-toggle');
var btnCurrentClass = $this.hasAnyClass(buttonClasses);
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;font-size:16px}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/php");</script>
@bretterer
bretterer / Disqus Wordpress Callbacks
Last active December 17, 2015 03:09
Disqus Wordpress callbacks
// In a js file
disqus_config = function() {
this.callbacks.afterRender.push(function() { /* your code */ });
this.callbacks.onNewComment.push(function() { /* your code */ });
/* Available callbacks are afterRender, onInit, onNewComment, onPaginate, onReady, preData, preInit, preReset */
}
example
Place the following right before the disqus element javascript
@bretterer
bretterer / Bootstrap 3 Breakpoints
Last active January 27, 2019 00:32
Bootstrap 3 Breakpoints
/* Tiny Devices: Phones */
@media (max-width: 767px) {
}
/* Small Devices: Tablets */
@media (min-width: 768px) and (max-width: 992px) {
}
/* Medium Devices: Desktops */
@bretterer
bretterer / buildApiDocs.php
Last active October 18, 2015 21:40
Build Stormpath Api Docs
<?php
return new Sami($iterator, array(
'theme' => 'symfony',
'title' => 'Symfony2 API',
'build_dir' => __DIR__.'/build',
'cache_dir' => __DIR__.'/cache',
'remote_repository' => new GitHubRemoteRepository('bretterer/stormpath-sdk-php', '/'),
'default_opened_level' => 2,
));
@bretterer
bretterer / buildApiDocs.sh
Last active October 18, 2015 23:58
Build API Docs for Stormpath
#!/bin/bash
echo "Building API Documentation"
curl -O http://get.sensiolabs.org/sami.phar
composer global require sami/sami
wget https://gist.githubusercontent.com/bretterer/7a6268a1ca36ba6401d2/raw/buildApiDocs.php
php sami.phar render buildApiDocs.php
ls -lah
@bretterer
bretterer / lctvbot.js
Last active December 8, 2015 21:45
Bot for Livecoding TV (based on https://github.com/Cristy94/livecoding-chat-bot)
var container = $('.message-pane');
var messageQueue = [];
var messageCount;
var greeted = [];
var textarea = $('#message-textarea');
var submit = $('input[type="submit"]');
var myUser = $('.main-navigation .user-name').text().trim().toUpperCase();
var gameStopped = true;
var botWritingCount = 0;
<?php
namespace Stormpath\Resource;
/*
* Copyright 2013 Stormpath, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
### Keybase proof
I hereby claim:
* I am bretterer on github.
* I am bretterer (https://keybase.io/bretterer) on keybase.
* I have a public key ASAUt2Ec3WBtxo8d_RVvwO_-9cAESY51T-FDabDiEM7xqAo
To claim this, I am signing this object:
@bretterer
bretterer / lctv-bot-help.md
Created May 14, 2016 17:57
LCTV Bot Gist

Core Commands

!unban

Unbans the specified user.

!ban

Bans the specified user.

!addcommand {command} {output}

Adds a new command to the bot (Mod only).