Skip to content

Instantly share code, notes, and snippets.

View yageek's full-sized avatar
🥨

Yannick Heinrich yageek

🥨
View GitHub Profile
@yageek
yageek / Simplify.swift
Created June 14, 2018 12:40 — forked from lachlanhurst/Simplify.swift
Simplification of a 3D polyline using the Ramer–Douglas–Peucker algorithm in Swift
//
// Simplify.swift
//
// Simplification of a 3D-polyline.
// A port of https://github.com/hgoebl/simplify-java for Swift
//
//
// The MIT License (MIT)
//
// Created by Lachlan Hurst on 10/02/2015.
@yageek
yageek / miostdin.rs
Created July 25, 2018 08:59 — forked from vi/miostdin.rs
Simple copy stdin to stdout example using Rust mio
extern crate mio;
use mio::unix::EventedFd;
use std::fs::File;
use mio::{Token, PollOpt, Ready, Poll, Events};
//use mio_uds::UnixStream;
use std::os::unix::io::{FromRawFd};
use std::io::{Read, Write};
@yageek
yageek / miniCas.cpp
Created September 14, 2018 02:48 — forked from andr1972/miniCas.cpp
Algebraic substitution trees, expand variables to subtree with cloning
#include <memory>
#include <string>
#include <vector>
#include <assert.h>
using namespace std;
enum Type { tEmpty, tNum, tVar, tFrac, tProd, tSum };
enum Precedence { precStart, precSum, precFrac, precAtom };
@yageek
yageek / ssh-git-push
Created September 21, 2018 06:50 — forked from t2/ssh-git-push
Github & Bitbucket (SSH) - Port 22 Blocked
# vi ~/.ssh/config
Host github.com
Hostname ssh.github.com
Port 443
Host bitbucket.org
Hostname altssh.bitbucket.org
Port 443
@yageek
yageek / Thick Line to Polygon JS
Created November 2, 2018 13:24 — forked from kekscom/Thick Line to Polygon JS
A JavaScript method to turn thick lines into polygons
/**
* @author Jan Marsch (@kekscom)
* @example see http://jsfiddle.net/osmbuildings/2e5KX/5/
* @example thickLineToPolygon([{x:50,y:155}, {x:75,y:150}, {x:100,y:100}, {x:50,y:100}], 20)
* @param polyline {array} a list of point objects in format {x:75,y:150}
* @param thickness {int} line thickness
*/
var thickLineToPolygon = (function () {
function getOffsets(a, b, thickness) {
@yageek
yageek / playground.rs
Created December 14, 2018 21:59 — forked from anonymous/playground.rs
Rust code shared from the playground
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
extern crate chrono;
use chrono::NaiveDate;
mod date_serde {

Looking into the Future

futures-rs is the library which will hopefully become a shared foundation for everything async in Rust. However it's already become renowned for having a steep learning curve, even for experienced Rustaceans.

I think one of the best ways to get comfortable with using a library is to look at how it works internally: often API design can seem bizarre or impenetrable and it's only when you put yourself in the shoes of the library author that you can really understand why it was designed that way.

In this post I'll try to put down on "paper" my understanding of how futures work and I'll aim to do it in a visual way. I'm going to assume you're already somewhat familiar with Rust and why futures are a useful tool to have at one's disposal.

For most of this post I'll be talking about how things work today (as of September 2017). At the end I'll touch on what's being proposed next and also make a case for some of the changes I'd like to see.

If you're interested in learning more ab

@yageek
yageek / simctl-commands.txt
Created September 28, 2019 16:30 — forked from keith/simctl-commands.txt
All the subcommands of `xcrun simctl` (including ones that aren't listed in `simctl help`) LC_SOURCE_VERSION 681.5.4
delete
pbpaste
terminate
keyboard_set_language
erase
pbsync
diagnose
status_bar
openurl
get_app_container
http://devstreaming.apple.com/videos/wwdc/2014/403xxksrj0qs8c0/403/403_hd_intermediate_swift.mov
http://devstreaming.apple.com/videos/wwdc/2014/419xxli6f60a6bs/419/419_hd_advanced_graphics_and_animation_performance.mov
http://devstreaming.apple.com/videos/wwdc/2014/101xx36lr6smzjo/101/101_hd.mov
http://devstreaming.apple.com/videos/wwdc/2014/236xxwk3fv82sx2/236/236_hd_building_interruptible_and_responsive_interactions.mov
http://devstreaming.apple.com/videos/wwdc/2014/306xxjtg7uz13v0/306/306_hd_javascript_for_automation.mov
http://devstreaming.apple.com/videos/wwdc/2014/404xxdxsstkaqjb/404/404_hd_advanced_swift.mov
http://devstreaming.apple.com/videos/wwdc/2014/701xx8n8ca3aq4j/701/701_hd_designing_accessories_for_ios_and_os_x.mov
http://devstreaming.apple.com/videos/wwdc/2014/224xxxlsvigdoc0/224/224_hd_core_os_ios_application_architectural_patterns.mov
http://devstreaming.apple.com/videos/wwdc/2014/717xxux5eg6f9v4/717/717_hd_kids_and_apps.mov
http://devstreaming.apple.com/videos/wwdc/2014/716xx8q4shlqcp8/716/
//
// SAWKWebView.swift
//
// Created by Costantino Pistagna on 24/01/2020.
// Copyright © 2020 Sofapps. All rights reserved.
//
import UIKit
import WebKit