Skip to content

Instantly share code, notes, and snippets.

View RamonGilabert's full-sized avatar

Ramon Gilabert RamonGilabert

View GitHub Profile
import UIKit
class Squircle: UIView {
private var radius: CGFloat = 0
private var smooth: CAShapeLayer?
var smoothCorners: Bool = false {
didSet {
updateMaskIfNeeded()
}
@RamonGilabert
RamonGilabert / Graph.js
Created March 1, 2019 17:21
Graph Calculation
function Graph(top_point, bottom_point) {
const increments = [2.5, 5, 10];
const difference = top_point - bottom_point
const value = difference / 4;
var selected_increment = 0;
var iteration = 0
var multiplier = 1;
var gap = 0;
import UIKit
import PlaygroundSupport
class Controller: UIViewController {
static let red: UIColor = UIColor(red: 219/255, green: 10/255, blue: 64/255, alpha: 1)
static let size: CGSize = CGSize(width: 240, height: 240)
static let duration: TimeInterval = 2
static let transform: CGFloat = 0.39
static let delay: TimeInterval = Controller.duration * 2
import UIKit
import PlaygroundSupport
class Controller: UIViewController {
static let red: UIColor = UIColor(red: 219/255, green: 10/255, blue: 64/255, alpha: 1)
static let size: CGSize = CGSize(width: 240, height: 240)
static let duration: TimeInterval = 2.5
static let transform: CGFloat = 0.37
@RamonGilabert
RamonGilabert / Sublime
Created August 3, 2018 12:21
Sublime Text Theme
{
"color_scheme": "Packages/theme/theme.tmTheme",
"dictionary": "Packages/Language - English/en_US.dic",
"drag_text": false,
"font_face": "Maison Neue Mono",
"font_size": 15,
"ignored_packages":
[
"Vintage"
],
import UIKit
import PlaygroundSupport
class ViewController: UIViewController {
let scale = CGAffineTransform.init(scaleX: 0.9, y: 0.9)
let rotation = CGAffineTransform.init(rotationAngle: .pi / 2)
let blue = UIColor(red: 0.25, green: 0.85, blue: 1, alpha: 1)
let red = UIColor(red: 1, green: 0.55, blue: 0.55, alpha: 1)
var state = 0
@RamonGilabert
RamonGilabert / Hidden.swift
Created November 10, 2016 14:57
A camera controller that generates the camera image, applies a blending mode and reads a QR code if existent.
import UIKit
import PhotosUI
import AVFoundation
class ViewController: UIViewController {
lazy var session: AVCaptureSession = {
let session = AVCaptureSession()
session.sessionPreset = AVCaptureSessionPresetPhoto
# COPY OF: https://github.com/sjl/z-fish JUST CHANGING Z FOR S. ALL THE CREDIT GOES TO SJL.
# Maintains a jump-list of the directories you actually use
#
# Usage:
# * s foo # goes to most frecent dir matching foo
# * s foo bar # goes to most frecent dir matching foo and bar
# * s -r foo # goes to highest ranked dir matching foo
# * s -t foo # goes to most recently accessed dir matching foo
# * s -l foo # list all dirs matching foo (by frecency)

Image

Just fucking do it!

It’s hard to say when a project is completed. When something that has taken your heart and soul for more than 6 months every day after work is done. This is a story of my thesis, Lights. But most importantly, this is a story to tell you that if you have an idea. If you have something that makes you curious. Something that is there making you hesitate if you should do it or not. Stop thinking. Just fucking do it.

This is the story of how I took my little knowledge in computer science and electronics. Building a prototype of a controllable light out of it. Every afternoon, for 6 months.

The beginning

import UIKit
class ViewController: UIViewController {
struct Constants {
static let offset: CGFloat = 5
static let height: CGFloat = 300
static let maximum: CGFloat = Constants.height + Constants.offset
static let maximumY = UIScreen.mainScreen().bounds.height - Constants.maximum
static let velocity: CGFloat = 250