Skip to content

Instantly share code, notes, and snippets.

"use strict";
let Plug = require("./Plug");
let { extend } = require("../utility");
let defaults = {
initial: 2, // Starting delay in seconds.
factor: 2, // After a failed reconnection attempt, multiply current delay by this factor.

cord

cord is chat bot framework, currently supporting IRC and Discord as well as the name of our personal bot residing thhe #obsidian community IRC channel and Discord server. One of cord's strengths is its modularity:

  • Sockets provide a common interface for dealing with different services.
  • Plugs is just our obviously brilliant way of saying "plugins". I know you like it too.
"use strict";
let { Client } = require("discord.js");
let Service = require("./Service");
let { map, filter, any, join } = require("../utility");
let DiscordService = module.exports = class DiscordService extends Service {
{
"irc": {
"server": "irc.esper.net",
"serverName": "Esper.NET",
"nick": "cordy",
"userName": "cordy",
"realName": "#obsidian Research Bot",
"channels": [ "#cordy" ]
},
"discord": {
var beam = {
"channelID": 38756,
"getFollowers": function(limit) {
return $.getJSON("https://beam.pro/api/v1/channels/" + beam.channelID).promise()
.then(function(channelData) {
return (function getFollowers(numFollowers, count, followers, page) {
var limit = Math.min(count, 100);
if (page == null) page = Math.floor(numFollowers / limit);
return $.getJSON("https://beam.pro/api/v1/channels/" + beam.channelID +
"/follow?page=" + page + "&limit=" + limit + "&fields=username").promise()
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
namespace WDTranslate
{
class MainClass
{
@copygirl
copygirl / cord.ls
Created October 27, 2015 00:42
Fiddled-together IRC - Discord bridge bot
# Fiddled-together IRC - Discord bridge bot
# Currently set up to relay messages to channels of the same name.
# Discord APIs are very likely to change, and so this will probably break.
require! {
irc # npm install node-irc
"discord.js": Discord # npm install discord.js
"prelude-ls": { find } # npm install prelude-ls
"./auth" # Configuration goes in auth.json file
# auth.irc contains IRC information, see clientIrc
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OtherEngine.Utility
{
/// <summary> Helper class that stores a fixed number of bits, provides
/// indexed access and implements bitwise and equality operators. </summary>
public class BitArray : IEquatable<BitArray>, IEnumerable<bool>
using System;
using System.Collections.Generic;
using OtherEngine.Utility;
namespace OtherEngine.ES
{
/// <summary> Represents which (important) types of components are on an entity,
/// or alternatively which component types a processor is interested in. </summary>
public class Aspect : IEquatable<Aspect>
{
var cloneUrl = ...;
var branchName = ...;
var git = Git.Init().SetDirectory(Location).Call();
Repository = git.GetRepository();
// Original code in question works, is shorter,
// but this is most likely the "proper" way to do it.
var config = Repository.GetConfig();
RemoteConfig remoteConfig = new RemoteConfig(config, "origin");