Skip to content

Instantly share code, notes, and snippets.

@Shmiddty
Shmiddty / jstraining.js
Created December 30, 2013 19:47
JS Training Session 1: Variables, Functions, Arguments, Primitives, Objects, Properties, and References.
/****************
* Variables *
****************/
var foo = 99;
//"var" is the syntax used for declaring a variable. It doesn't matter what
//type of value you want to store in the variable, JavaScript doesn't care.
bar = 'banana';
//omitting the "var" keyword will still create a variable (if it doesn't
//already exist in the scope), but it will be implicitly global.
@Shmiddty
Shmiddty / Responses.js
Created October 10, 2013 16:27
AFK responses for SOChatBot
var responses = [
{
outgoing : 'Why are you leaving me!?',
incoming : [
'Welcome back!', 'Where were you!?',
'You saw that whore again, didn\'t you!?'
]
},
{
outgoing : 'Just go already!',
@Shmiddty
Shmiddty / afk.js
Last active December 24, 2015 16:39
Afk command for SO chat
//solves #86, written by @Shmiddty: https://gist.github.com/Shmiddty/6829439
(function () {
"use strict";
// "user name" : {lastPing : Date.now(), msg : "afk message", returnMsg: "bot sends this when you return"}
var demAFKs = bot.memory.get( 'afk' );
//5 minute limit between auto-responds.
var rateLimit = 5 * 60 * 1000;
var responses = [