Skip to content

Instantly share code, notes, and snippets.

View olegkorol's full-sized avatar
👋
Hi there!

Oleg Korol olegkorol

👋
Hi there!
View GitHub Profile
@olegkorol
olegkorol / firebase.json
Created February 13, 2023 08:42 — forked from katowulf/firebase.json
Example of Firebase emulator unit tests and seed Firestore data
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"emulators": {
"firestore": {
"port": 8080
}
}
@olegkorol
olegkorol / GIF-Screencast-OSX.md
Created March 26, 2021 10:14 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

import java.util.Scanner;
public class TicTacToe {
public static int getValidInt(String prompt) {
Scanner in = new Scanner(System.in);
while(true)
{
System.out.print(prompt);
@olegkorol
olegkorol / chart.vue
Created January 31, 2018 15:10 — forked from rvanzon/nuxt.config.js
A way to use vue-chartjs as a plugin of Nuxt.js
// just an example. A cleaner way is to wrap the showLine-stuff in a dedicated component
<template>
<div>
<my-line v-if="showLine" :data="lineData" :options="options">
</div>
</template>
<script>
export default {
data () {
/* chatbots.js */
// […]
// listener that handles incoming messages
slackController.hears(['.*'], ['direct_message', 'direct_mention'], (bot, message) => {
// pass the slack message to IBM Watson's Conversation
Conversation.sendMessage(String(message.text), undefined)
.then(response => {
slackController.log('Response from Watson received');
/* chatbots.js */
const Botkit = require('botkit');
const Conversation = require('./conversation'); // this is new
const slack_token = process.env.SLACK_TOKEN;
const slack_oauth = process.env.SLACK_OAUTH;
exports.fn = {
/**
* Starts Slack-Bot
*
/* conversation.js */
const ConversationV1 = require('watson-developer-cloud/conversation/v1');
// new instance of Conversation
const conversation = new ConversationV1({
username: process.env.CONVERSATION_USERNAME,
password: process.env.CONVERSATION_PASSWORD,
version_date: ConversationV1.VERSION_DATE_2017_02_03
});
/**
/* chatbots.js */
const Botkit = require('botkit');
// use the tokens you got from the previous step
const slack_token = process.env.SLACK_TOKEN;
const slack_oauth = process.env.SLACK_OAUTH;
exports.fn = {
/**
* Starts Slack-Bot
*
/* server.js */
const express = require('express');
const app = express();
const port = process.env.PORT || 4205;
const router = express.Router();
// start server
app.listen(port, function (req, res) {
console.info(`Started Express server on port ${port}`)
});
“scripts”: {
“start”: “node index.js”,
“deploy-to-now”: “now -e SALUTATION=@salutation”
},