Skip to content

Instantly share code, notes, and snippets.

View romshark's full-sized avatar
👨‍💻
Today's game: build an expr. parser in Go: https://play.golang.org/p/QyiDCAQPcSm

Roman Sharkov romshark

👨‍💻
Today's game: build an expr. parser in Go: https://play.golang.org/p/QyiDCAQPcSm
  • tutti.ch | Swiss Marketplace Group
  • Switzerland
  • X @romshar
View GitHub Profile
// create a new test called "SomeTest"
// timeout after 2 seconds automatically if not done
// run all cases in parallel
Test test("SomeTest", 2000, Test::parallel)
//synchronous test case
void synchronousCase1(Test::handle test) {
test.equal<int>(1, 2, "damn, 1 isn't equal 2");
test.equal<std::string>("foo", "foo");
test.notEqual<std::string>("foo", "bar");
@romshark
romshark / main.qml
Created August 5, 2017 16:07
QML Canvas export to SVG
import QtQuick 2.9
import QtQuick.Controls 1.4
import "tiger.js" as Tiger
ApplicationWindow {
visible: true
id: window
width: 640
height: 480
title: "SVG Test"
@romshark
romshark / graphql-identifier.js
Created September 19, 2017 18:14
GraphQL Apollo Custom Type
const {GraphQLScalarType} = require('graphql')
const {GraphQLError} = require('graphql/error')
const {Kind} = require('graphql/language')
function verifyString(str) {
const errorMsgBase = 'Type "Identifier" ' +
'must represent a 32 character string ' +
'including only the following characters: ' +
'"abcdefABCDEF1234567890" | '
@romshark
romshark / async-image.vue
Created November 5, 2017 23:14
Asynchronous image component for Vue.js
<template><div>
<div class="main"></div>
</div></template>
<script>
function prepare(mode, element) {
let styles = element.style
styles.opacity = 0
styles.WebkitTransition = 'opacity 200ms'
styles.MozTransition = 'opacity 200ms'
@romshark
romshark / file-url-encoder.html
Created December 5, 2017 15:36
Base64 URL File Encoder
<!DOCTYPE html>
<html>
<head>
<title>Base64 Encoder</title>
<style>
body {
margin: 0px;
width: 768px;
margin: auto;
padding-top: 2rem;

Webwire Benchmarking Tool

How to use

  1. Start the test server: go run test-server.go
  2. Run the benchmark: go run benchmark.go

Following parameters are available:

  • bench-dur: benchmark duration in seconds (default: 10)
  • addr: address of the target test server like localhost:80 (default: :8081)
  • clients: number of concurrent clients (default: 10)
@romshark
romshark / vue-loader.config.js
Created April 10, 2018 17:19
WebPack config
module.exports = {
extractCSS: process.env.NODE_ENV === 'production',
preserveWhitespace: false
}
@romshark
romshark / api.js
Created May 11, 2018 18:27
Api wrapper
import WebWireClient from '../../lib/webwire'
import signInPassword from './signInPassword'
let client
const api = {
init(host, port, handlers) {
client = new WebWireClient(host, port, { handlers })
},
@romshark
romshark / index.html
Last active July 10, 2018 07:09
ezw.uni-freiburg.de
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<meta charset="utf8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<!-- DEV STYLES -->
<style>
@romshark
romshark / proposal.md
Created September 2, 2018 16:42
A Go 2 (Go > 1.11) language feature proposal to immutability.

Go 2 - Immutability

This document describes a Go 2 (Go > 1.11) language feature proposal to immutability.

Author: Roman Sharkov (roman.sharkov@qbeon.com)

1. Introduction

A Go 1 developer's current approach to immutability is copying because Go 1.x doesn't currently provide any immutability annotations.

1.1. Current Problems