Skip to content

Instantly share code, notes, and snippets.

Avatar
💜
Doing something

Jacob Foster AlcaDesign

💜
Doing something
View GitHub Profile
@AlcaDesign
AlcaDesign / index.html
Last active Aug 15, 2021
[OUTDATED] An almost complete tmi.js example (browser)
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Chat</title>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700,300' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css">
<script src="https://d2g2wobxbkulb1.cloudfront.net/0.0.19/tmi.js"></script> <!--For developement-->
<!--<script src="https://d2g2wobxbkulb1.cloudfront.net/0.0.19/tmi.min.js"></script>--> <!--For "production"-->
</head>
@AlcaDesign
AlcaDesign / index.html
Last active Jan 16, 2022
tmi.js with BTTV emotes
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>BTTV Emotes Gist</title>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="https://d2g2wobxbkulb1.cloudfront.net/0.0.18/tmi.min.js"></script>
<script src="js/main.js"></script>
</head>
@AlcaDesign
AlcaDesign / compact.js
Last active Feb 19, 2016
Compact (or extract) a string into a different length but it comes out horribly disfigured.
View compact.js
var input = 'Now, this is a story all about how My life got flipped-turned upside down And I\'d like to take a minute Just sit right there I\'ll tell you how I became the prince of a town called Bel Air',
endLength = 165;
function rangeMap(n, in_min, in_max, out_min, out_max) {
return (n - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
function rangeMapFloor(n, a, b, c, d) {
return Math.floor(rangeMap(n, a, b, c, d));
}
@AlcaDesign
AlcaDesign / SniffingBot.js
Last active Dec 2, 2018
Code sniffing bot from multiple Twitch channels. Aggregates the codes to a specific channel for more chances at codes.
View SniffingBot.js
const _request = require('request'),
_ = require('lodash'),
tmi = require('tmi.js'),
clc = require('cli-color'),
config = require('./config.json'),
yourChannel = config.yourChannel || '',
identity = config.identity || {},
View index.js
'use strict';
const tmi = require('tmi.js'),
timerMessages = [],
config = {
identity: {
username: '',
password: ''
View index.js
'use strict';
const _ = require('lodash'), // Just to handle a couple of things more easily
tmi = require('tmi.js'),
channel = ''; // Your channel
let mainConfig = {
options: {
debug: true // Debug to console
View Logger.js
// Ascii colors in console
function colorize(id, ...text) {
return `\u001b[${id}m${text.join()}\u001b[39m`;
}
// The brightest white text
function whiteBright(...text) {
return colorize(97, ...text);
}
// The brightest white text
function blackBright(...text) {
View index-1.js
//...
client.on('message', (channel, user, message, fromSelf) => {
// Ignore bot's messages.
if(fromSelf) {
return false;
}
// The name of the user. (Will default to the lower case if the display name
// is missing from the user object.)
@AlcaDesign
AlcaDesign / Entity.java
Created Jan 7, 2017
[Processing] Particle thing
View Entity.java
class Entity {
PVector size = new PVector(entitySize, entitySize);
PVector pos = new PVector(0, 0);
PVector vel = new PVector(0, 0);
PVector acc = new PVector(0, 0);
color c;
boolean bounced = false;
int life = 0;
int lifeSpan = 200;
@AlcaDesign
AlcaDesign / index.js
Created Jan 8, 2017
A command bot example
View index.js
const tmi = require('tmi.js'),
request = require('request'),
countdown = require('countdown'),
kraken = request.defaults({
baseUrl: 'https://api.twitch.tv/kraken/',
json: true,
headers: {
'Client-ID': '',
Accept: 'application/vnd.twitchtv.v3+json'