Skip to content

Instantly share code, notes, and snippets.

@belsrc
belsrc / gist:672b75d1f89a9a5c192c
Last active April 15, 2023 15:13
Simple Vue.js filters that I usually need
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];
@Durek
Durek / steam-mailin.js
Last active September 27, 2020 13:55
Autmagically activate steam accounts
const mailin = require('mailin');
const request = require('request');
require('log-timestamp')(function() { return '[' + new Date(Date.now() - (new Date()).getTimezoneOffset() * 60000).toISOString().replace(/T/, ' ').replace(/\..+/, '') + '] %s'; });
const afterLink = ['Steam requires a verified email address so you can take full advantage of Steam', 'Steam setzt eine verifizierte E-Mail-Adresse voraus, um von allen'];
const linkStart = 'https://store.steampowered.com/account/newaccountverification?stoken=';
mailin.start({
port: 25,
disableWebhook: true,
@gurupras
gurupras / distributed-mediasoup.js
Created May 27, 2020 13:41
mediasoup horizontal scaling
onServerStartup () {
const { serverId, ip } = getServerInfo() // serverId does not change across restarts
this.serverId = serverId
// We don't have any routers or producers (yet). Clear any value that exists in the DB related to our serverId
clearSharedDB(serverId, 'routers')
clearSharedDB(serverId, 'producers')
// Update the DB with our serverId and ip so that others will know how to reach us
registerServerInDB(serverId, ip)