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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / 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);