Skip to content

Instantly share code, notes, and snippets.

View savely-krasovsky's full-sized avatar

Savely Krasovsky savely-krasovsky

View GitHub Profile

Golang Type Switch - Arbitrary JSON Array Parsing

I'm writing this mostly as a reference for myself. This could also be helpful to people who are new to GO.

Note 1:

Until Problem 3 we will assume we are dealing with a JSON for which we know the data types of key,value pairs. Only in Problem 3 we will look at how Type Switch is used to parse a 100% arbitary JSON

Note 2:

I know the following examples given here can be easily solved by declaring approprite structs and just decoding the PUT JSON into them, but, as im not able to come up with a better scenario, im going to stick with this to explain arbitrary JSON parsing.

@savely-krasovsky
savely-krasovsky / score.js
Last active October 16, 2023 13:07 — forked from fipso/score.js
Gamee Hacker Bot for Telegram
/**
* Created by fipso on 13.10.16.
*/
const CryptoJS = require('crypto-js');
const request = require('request-promise-native');
const TelegramBot = require('node-telegram-bot-api');
const bot = new TelegramBot('TOKEN', {polling: true});
@savely-krasovsky
savely-krasovsky / owncloud-nginx-pretty-urls.conf
Last active July 16, 2016 15:20 — forked from stevenmirabito/owncloud-nginx-pretty-urls.conf
Nginx configuration for ownCloud with support for URL rewriting (https://github.com/owncloud/core/pull/14081)
server {
listen 80;
listen [::]:80;
server_name shorten.pro;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;