Skip to content

Instantly share code, notes, and snippets.

View simonwuyts's full-sized avatar

Simon Wuyts simonwuyts

View GitHub Profile
@simonwuyts
simonwuyts / TooltipView.swift
Last active February 5, 2024 19:28
Customizable Tooltips
//
// TooltipView.swift
// Customizable Tooltips
//
// Copyright © 2017 Simon Wuyts
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@simonwuyts
simonwuyts / inspectables.swift
Created June 5, 2017 12:50
The Inspectables
@IBInspectable var arrowTopLeft: Bool = false
@IBInspectable var arrowTopCenter: Bool = true
@IBInspectable var arrowTopRight: Bool = false
@IBInspectable var arrowBottomLeft: Bool = false
@IBInspectable var arrowBottomCenter: Bool = false
@IBInspectable var arrowBottomRight: Bool = false
@IBInspectable var fillColor: UIColor = UIColor.white
@IBInspectable var borderColor: UIColor = UIColor(red:0, green:0, blue:0, alpha:0.05)
// Define Bubble Shape
let bubblePath = UIBezierPath()
// Top left corner
bubblePath.move(to: topLeft(0, borderRadius))
bubblePath.addCurve(to: topLeft(borderRadius, 0), controlPoint1: topLeft(0, borderRadius / 2), controlPoint2: topLeft(borderRadius / 2, 0))
// Top right corner
// Shadow Layer
let shadowShape = CAShapeLayer()
shadowShape.path = bubblePath.cgPath
shadowShape.fillColor = fillColor.cgColor
shadowShape.shadowColor = shadowColor.cgColor
shadowShape.shadowOffset = CGSize(width: CGFloat(shadowOffsetX), height: CGFloat(shadowOffsetY))
shadowShape.shadowRadius = CGFloat(shadowBlur)
shadowShape.shadowOpacity = 0.8

Keybase proof

I hereby claim:

  • I am simonwuyts on github.
  • I am simonwuyts (https://keybase.io/simonwuyts) on keybase.
  • I have a public key ASDDLhO86hPaDDyZp2MZ5oQEv8a4eAdKOqr0uVwZLgNRDQo

To claim this, I am signing this object:

@simonwuyts
simonwuyts / cloudSettings
Created August 27, 2018 18:29
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-08-27T18:29:35.440Z","extensionVersion":"v3.0.0"}
<script>
function replaceFirstImage() {
var imageData = document.querySelector('[data-slideshow-history]').getAttribute('data-slideshow-url')
var visibleImage = document.querySelector('.slideshow__image__inner img')
$.getJSON(imageData, function(data) {
if (data.length > 1) {
var controls = document.querySelector('.slideshow__controls')
visibleImage.setAttribute('src', data[1].file)
controls.style.display = 'none'
// Add a <g> element for every data point
const leaf = svg.selectAll('g').data(circles)
// Append a styled <circle> to every <g> element
leaf
.append('circle')
.attr('id', d => d.data.id)
.attr('r', d => d.r)
.attr('fill-opacity', 0.7)
.attr('fill', d => d.data.color)
<template>
<svg width="500" height="500">
</svg>
</template>
<script>
export default {
data() {
return {
flowers: [
<template>
<svg width="500" height="500">
</svg>
</template>
<script>
export default {
data() {
return {
flowers: [