Skip to content

Instantly share code, notes, and snippets.

View psychobunny's full-sized avatar
❤️
Making forums great again™

Andrew Rodrigues psychobunny

❤️
Making forums great again™
View GitHub Profile
@psychobunny
psychobunny / partials.js
Created February 12, 2015 16:43
Client-side partials parsing
var matches = null,
regex = regex = /[ \t]*<!-- IMPORT ([\s\S]*?)? -->[ \t]*/g,
apiCalls = [],
matchList = [],
deferredObjects = [];
while((matches = regex.exec(html)) !== null) {
var deferredObject = $.Deferred();
deferredObjects.push(deferredObject);
@psychobunny
psychobunny / core.js
Last active August 29, 2015 14:18
FlightJS inspired components system for NodeBB
define('notifications', ['events', 'components'], function(events, components) {
var notifications = {};
notifications.init = function() {
events.initialize('notifications', function() {
this.register('icon.unread', markUnread);
this.register('icon.read', markRead);
});
@psychobunny
psychobunny / templates.js
Created May 21, 2015 18:19
templates.js optimized
'use strict';
/*global require, module, self*/
(function(module) {
var templates = {
cache: {},
globals: {}
},
helpers = {},
loader,
@psychobunny
psychobunny / 502.html
Created September 1, 2015 03:47
The NodeBB Community's 502 page
<html>
<head>
<title>The NodeBB Community Forum is Under Maintenance</title>
<link href='http://fonts.googleapis.com/css?family=Ubuntu:400,500,700' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
background: #00A9EA;
color: white;
font-family: 'Ubuntu', sans-serif;
text-align: center;
@psychobunny
psychobunny / comments.php
Created May 24, 2014 00:50
Wordpress integration with NodeBB
<?php
if ( post_password_required() )
return;
?>
<a id="nodebb/comments"></a>
<script type="text/javascript">
var nodeBBURL = 'http://forum.burnaftercompiling.com',
articleID = '<?php echo the_ID(); ?>';
@psychobunny
psychobunny / twitch-pokemon.html
Created February 21, 2014 18:50
[nodebb-script-pokemon-twitch] Twitch plays Pokemon, on your NodeBB forum!
<object data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=twitchplayspokemon" height="250" id="live_embed_player_flash" type="application/x-shockwave-flash" width="100%"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" /><param name="flashvars" value="hostname=www.twitch.tv&amp;channel=twitchplayspokemon&amp;auto_play=true&amp;start_volume=0" /></object>
@psychobunny
psychobunny / widget.html
Created February 21, 2014 07:33
[nodebb-script-snake] Embed a Snake Flash game on your NodeBB forum
<embed src="http://www.neave.com/games/get_game.php?swf=snake" name="neaveSnake" width="100%" quality="high" pluginspage="http://get.adobe.com/flashplayer/" type="application/x-shockwave-flash" allowscriptaccess="always"></embed>
@psychobunny
psychobunny / import.js
Created March 2, 2016 18:52
Script: Deleting topics/posts from a JSON file containing pids and tids
'use strict';
/*globals require, console, process */
var nconf = require('nconf');
var async = require('async');
nconf.file({
file: 'config.json'
});
@psychobunny
psychobunny / index.html
Created April 1, 2014 21:28
[nodebb-script-category-dropdown] Category Dropdown Widget for NodeBB
<div id="category-selector" style="position: relative">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" type="button">Categories <span class="caret"></span></button>
<ul class="dropdown-menu" aria-labelledby="category-selector">
</ul>
</div>
<br />
<script>
// If you're using the custom homepage mod, switch the api call to /api/forum
$.get(RELATIVE_PATH + '/api/home', {}, function(data) {
@psychobunny
psychobunny / irc.html
Created February 21, 2014 17:47
[nodebb-script-irc] Embed IRC on your NodeBB forum
<iframe src="https://kiwiirc.com/client/card.freenode.net/?nick=anonymous|?&theme=basic#nodebb" style="border:0; width:100%; height:450px;"></iframe>