This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var matches = postData.content.match(/!\[.*?]\(.*?\)/g); | |
console.log('matches', matches); | |
if (matches && matches.length) { | |
matches.forEach(function(image) { | |
if (image.indexOf('](http://') === -1 && image.indexOf('](https://') === -1 && image.indexOf('](/') === -1) { | |
console.log('not ALOUD', image); | |
postData.content = postData.content.replace(image, ''); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nconf = require('nconf'); | |
var async = require('async'); | |
nconf.file({ | |
file: 'config.json' | |
}); | |
var redis = require('redis'); | |
var db = require('./src/database'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nconf = require('nconf'); | |
var async = require('async'); | |
var fs = require('fs'); | |
nconf.file({ | |
file: 'config.json' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//use filter:topics.get in plugin.json | |
//{ "hook": "filter:topics.get", "method": "addMainPostContent"} | |
module.addMainPostContent = function(data, callback) { | |
var topics = data.topics; | |
var keys = topics.map(function(topic) { | |
return topic && 'topic:' + topic.tid; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/*globals require, console, process */ | |
var nconf = require('nconf'); | |
var async = require('async'); | |
var fs = require('fs'); | |
nconf.file({ | |
file: 'config.json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#mongodb queries | |
db.objects.find({ $and: [ | |
{ _id: { $gt: ObjectId("5b06052649f0a0999558b960")} }, | |
{ _key: { $not: /^anal.*/ } }, | |
{ _key: { $not: /^group.*/ } }, | |
{ _key: { $not: /^user/ } }, | |
{ _key: { $not: /^post/ } }, | |
{ _key: { $not: /^topic/ } }, | |
{ _key: { $not: /^chat/ } }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/*globals require, console, process */ | |
var nconf = require('nconf'); | |
var async = require('async'); | |
nconf.file({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ratelimit.rateLimitReq = function(req, res, next) { | |
if (!req.session) { | |
return next(); | |
} | |
req.session.lastRequestTime = req.session.lastRequestTime || 0; | |
var now = Date.now(); | |
if (now - req.session.lastRequestTime < 200) { | |
if (res.locals.isAPI) { | |
res.status(429).json('too-many-requests'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/*globals require, console, process */ | |
var nconf = require('nconf'); | |
var async = require('async'); | |
nconf.file({ | |
file: 'config.json' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <windows.h> | |
void doTheHack() | |
{ | |
FILE *pFile; | |
FILE *pOut; | |
char *buffer; | |
long fileSize; | |