Skip to content

Instantly share code, notes, and snippets.

View IgorMuzyka's full-sized avatar

Igor Muzyka IgorMuzyka

View GitHub Profile
@inamiy
inamiy / SwiftElmFrameworkList.md
Last active March 11, 2024 10:20
React & Elm inspired frameworks in Swift
@xaviervia
xaviervia / README.md
Last active February 16, 2021 20:12
Sketch 43 files JSON types
@JadenGeller
JadenGeller / Cluster.swift
Created March 13, 2017 01:27
Class Cluster
class Number /* class cluser */ {
class Int8: Number {
var value: Swift.Int8
init(_ value: Swift.Int8) { self.value = value }
}
class Int: Number {
var value: Swift.Int
init(_ value: Swift.Int) { self.value = value }
}
@jay18001
jay18001 / Matrix4.swift
Created February 24, 2017 02:57
Swift version of helper class from Ray Wenderlich: Metal Tutorial with Swift 3 Part 2
import UIKit
import GLKit
extension Float {
var radians: Float {
return GLKMathDegreesToRadians(self)
}
}
class Matrix4 {
// Scanner+Swift.swift
//
// A set of idiomatic swift extensions to Scanner
//
// Based on https://gist.github.com/natecook1000/59bb0c9117b555f5d40d
// Converted to Swift 3
//
import Foundation
public func projectFunctionToCoordinateSystem(function f: FunctionType) -> (p0: CGPoint, p1: CGPoint) -> (x: CGFloat) -> CGPoint {
return { p0, p1 in
return { x in
let (dx, dy) = (p1.x - p0.x, p1.y - p0.y)
let (magnitude, theta) = (hypot(dy, dx), atan2(dy, dx)) // Thanks loooop
var outPoint = CGPoint(x: x * magnitude, y: f(x) * magnitude)
outPoint = CGPointApplyAffineTransform(outPoint, CGAffineTransformMakeRotation(theta))
outPoint = CGPointApplyAffineTransform(outPoint, CGAffineTransformMakeTranslation(p0.x, p0.y))
return CGPoint(x: outPoint.x, y: outPoint.y)
}
@jkeen
jkeen / chat.sql
Created November 30, 2015 05:26
iMessage chat.db deciphering
SELECT
m.rowid as message_id,
(SELECT chat_id FROM chat_message_join WHERE chat_message_join.message_id = m.rowid) as message_group,
CASE p.participant_count
WHEN 0 THEN "???"
WHEN 1 THEN "Individual"
ELSE "Group"
END AS chat_type,
DATETIME(date +978307200, 'unixepoch', 'localtime') AS date,
CASE is_from_me
@ericandrewlewis
ericandrewlewis / index.md
Last active June 6, 2024 01:43
C++ Pointer Tutorial

C++ Pointer Tutorial

Because pointers can be ugh

"Regular" variables (not pointers)

To understand a pointer, let's review "regular" variables first. If you're familiar with a programming language without pointers like JavaScript, this is what you think when you hear "variable".

When declaring a variable by identifier (or name), the variable is synonymous with its value.

@epohs
epohs / ncurses.swift
Last active July 7, 2020 01:23
How to setup and use ncurses in a Swift script
#!/usr/bin/env xcrun swift -i
import Foundation
import Darwin.ncurses
initscr() // Init window. Must be first
cbreak()
noecho() // Don't echo user input
nonl() // Disable newline mode
intrflush(stdscr, true) // Prevent flush
@PurpleBooth
PurpleBooth / README-Template.md
Last active November 17, 2024 02:42
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites