Skip to content

Instantly share code, notes, and snippets.

View agilob's full-sized avatar
🐧

agilob agilob

🐧
View GitHub Profile
@agilob
agilob / dart-websocket.dart
Created June 25, 2020 19:49
Example use of dart.io websocket
WebSocket _wss; // class level field, so you can use it in methods
//method level
await WebSocket.connect(uri).timeout((Duration(seconds: 5))).then(
(WebSocket ws) {
_wss = ws;
if (_wss?.readyState == WebSocket.open) {
// you can tell server who you are here, right after connecting
@agilob
agilob / sleep_sort.dart
Created May 18, 2018 12:21
Sleep sort implementation in Dart
import 'dart:async';
class Input {
var sleepTimes = new List();
}
main(List<String> arguments) async {
var input = new Input();
arguments.forEach((val) { input.sleepTimes.add(num.parse(val)); } );
@agilob
agilob / formatter.user.js
Created February 13, 2018 18:54
wykop code formatter
// ==UserScript==
// @name codeFormatter
// @homepage https://kmiasko.github.io/
// @version 0.0.2
// @description codeFormatter - umożliwia zachowanie spacji w kodzie oraz koloruje składnię JS na wykop.pl
// @author kmiasko
// @match https://www.wykop.pl/*
// @grant none
// @require https://cdn.rawgit.com/kmiasko/highlight.js/master/build/highlight.pack.js
// @run-at document-end