Skip to content

Instantly share code, notes, and snippets.

View index.js
const Discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if (message.content === '!react-await') {
message.react('👍').then(() => message.react('👎'));
@thomasstr
thomasstr / realtime.js
Created Feb 6, 2021
Await for reaction Discord JS
View realtime.js
const Command = require("../base/Command.js");
class Realtime extends Command
{
constructor (client)
{
super(client,
{
name: "realtime",
description: "Gets realtime stock values",
View embed.js
var arr = ["User1", "User2", "User3"];
message.channel.send({embed: {
color: 3447003,
author: {
name: client.user.username,
icon_url: client.user.avatarURL
},
title: "This is an embed",
url: "http://google.com",
View helloworld.ino
/* Hello World OLED Test */
#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"`
SSD1306 display(0x3c, 4, 5); // Initialise the OLED display using Wire library (D2 and D1 on NodeMCU)
void setup()
{
Serial.begin(9600);
display.init(); // Initialising the UI will init the display too.
display.flipScreenVertically();
display.normalDisplay();
View app.js
var express = require('express')
, session = require('express-session')
, passport = require('passport')
, Strategy = require('./lib').Strategy
, app = express()
, path = require('path')
, engines = require('consolidate')
const conn = require('./knex/MySQL');
passport.serializeUser(function(user, done) {
View app.js
const connection = require('./knex/MySQL');
var checkUser = conncetion.userExists("226018734496546817")
if (checkUser == 1) {
console.log("User exists");
else {
connection.createUser({
name: "Thomas Strømme",
id: "226018734496546817"
View output.rb
#<RUBG::Participant:0x007f91bdd414c0 @participant_id="77e81b3a-b646-4f98-bf98-5588c3b7d508", @actor="", @shard="pc-na", @dbnos=8, @assists=0, @boosts=3, @damage_dealt=942.960144, @death_type="byplayer", @headshot_kills=2, @heals=14, @kill_place=1, @kill_ranking_before=1000, @kill_ranking_gained=0, @kill_streaks=3, @kills=10, @last_kill_points=0, @last_win_points=0, @longest_kill=57.8827133, @most_damage=0, @name="StoneMountain64", @player_id="account.6c30f024b3ec4283baefd39f3cb5694e", @revives=0, @ride_distance=0, @road_kills=1, @team_kills=0, @time_survived=1385.811, @vehicle_destroys=0, @walk_distance=3190.1543, @weapons_acquired=11, @win_place=14, @win_ranking_before=1500, @win_ranking_gained=0, @overall_ranking_gained=0, @stats={"DBNOs"=>8, "assists"=>0, "boosts"=>3, "damageDealt"=>942.960144, "deathType"=>"byplayer", "headshotKills"=>2, "heals"=>14, "killPlace"=>1, "killPoints"=>1000, "killPointsDelta"=>0, "killStreaks"=>3, "kills"=>10, "lastKillPoints"=>0, "lastWinPoints"=>0, "longestKill"=>57.8827133,
View apng.php
<?php
function splitapng($data) {
$parts = array();
// Save the PNG signature
$signature = substr($data, 0, 8);
$offset = 8;
$size = strlen($data);
while ($offset < $size) {
// Read the chunk length
View product-image.php
<?php
/**
* Single Product Image
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-image.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
View run.rb
bot.command(:top10, in: "ma-fakka", description: "!top10") do |event|
db = DB.new
res = db.top10
this_res = res.each_with_index.map { |r| "#{r['displayName']} #{r['gameScore']}" }
// Print result from MySQL result like this
// 1. name score
// 2. name score
// 3. name score
event.respond this_res
end