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 / debug.js
Last active April 16, 2020 09:46
NodeBB patch - Remove OP and replace it with first reply
// paste this in https://github.com/NodeBB/NodeBB/blob/master/src/routes/debug.js
// and then don't forget to remove it!
router.get('/remove-op', function(req, res) {
var db = require('../database'),
async = require('async');
db.getSortedSetRange('topics:tid', 0, -1, function(err, tids) {
async.eachLimit(tids, 50, function(tid, next) {
db.getSortedSetRange('tid:' + tid + ':posts', 0, 0, function(err, pid) {
@psychobunny
psychobunny / index.js
Last active July 13, 2018 02:16
Add CSV list of user emails to a specific group in NodeBB
"use strict";
/*
BACK UP YOUR DB BEFORE RUNNING
modify these:
*/
var inputFile = 'emails.csv';
var groupToJoin = 'global-moderators';
@psychobunny
psychobunny / client.js
Created May 16, 2018 21:18
colorize usernames in nodebb according to group badge
$(document).ready(function() {
function colorize() {
$('a[href*="/user/"').each(function() {
var link = $(this);
var username = link.attr('href').match(/\/user\/(\w+)/);
$.get('/api/user/' + username[1], function(data) {
// todo: check `data.groupTitle` and then find the matching group in `data.groups`
if (data.groups[0]) {
link.css({color: data.groups[0].labelColor});
@psychobunny
psychobunny / CLA.md
Last active January 31, 2018 01:40
NodeBB Contributor License Agreement

NodeBB Individual Contributor Assignment Agreement

Thank you for your interest in contributing to an open source project run by NodeBB Inc. ("We" or "Us"). This NodeBB Individual Contributor Assignment Agreement ("Agreement") documents the rights granted by contributors to Us.

To make this document effective, please sign it and send it to Us by mail, email, or electronic submission, following the instructions at https://github.com/NodeBB/NodeBB/blob/master/.github/CONTRIBUTING.md. This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us.

2. Grant of Rights

2.1 Copyright Assignment

@psychobunny
psychobunny / Zendesk-README.md
Created January 26, 2018 19:28
Step-by-step instructions on configuring NodeBB's Zendesk integration

Documentation

Admin Control Panel

This plugin can be configured at NodeBB Admin -> Plugins -> Support Tickets.


@psychobunny
psychobunny / library.js
Last active April 24, 2016 10:30
NodeBB plugin - adding main post data to category view
var topics = module.parent.require('./topics'),
async = module.parent.require('async');
var plugin = {};
plugin.addPostData = function(data, uid, callback) {
async.map(data.topics, function(topic, next) {
topics.getMainPost(topic.tid, uid, function(err, mainPost) {
topic.mainPost = mainPost;
next(err, topic);
@psychobunny
psychobunny / rss.html
Created February 21, 2014 08:05
[nodebb-script-rss] Embed an RSS feed from your blog as a NodeBB widget
<table id="feed" class="table table-striped"></table>
<script type="text/javascript">
var feed_url = 'http://blog.nodebb.org/rss';
jQuery.ajax({
type: "GET",
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(feed_url),
dataType: 'json',
success: function(data){
values = data.responseData.feed.entries;
@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>
@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 / 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'
});