Skip to content

Instantly share code, notes, and snippets.

View slimlime's full-sized avatar
😀
Hello, welcome to Weiber.

slimlime

😀
Hello, welcome to Weiber.
  • Australia
View GitHub Profile
import Foundation
let json = """
{
"user_id": 1,
"user_name": "magicien",
"friends": [
{
"user_id": 2,
"is_best_friend": true
import Foundation
let json = """
[
{ "name": "magicien" },
{ },
{ "name": "NoName" }
]
""".data(using: .utf8)!
import Foundation
let json = """
{
"user_id": 1,
"user_name": "magicien",
"friends": [
{
"user_id": 2,
"is_best_friend": true
import Foundation
let json = """
{
"user_id": 1,
"user_name": "magicien",
"friends": [
{
"user_id": 2,
"is_best_friend": true
import Foundation
let json = """
{
"user_id": 1,
"user_name": "magicien",
"url": "http://darkhorse2.0spec.jp"
}
""".data(using: .utf8)!
@slimlime
slimlime / commonprofile.metal
Created December 17, 2018 05:53 — forked from magicien/commonprofile.metal
Can't access GL Uniforms in Metal shader modifier? Apple docs for SCNShadable written in terms of GL? Pulling your hair out?... this will help.
////////////////////////////////////////////////
// CommonProfile Shader v2
#import <metal_stdlib>
using namespace metal;
#ifndef __SCNMetalDefines__
#define __SCNMetalDefines__
public func Cross(_ q1: SCNQuaternion, _ q2: SCNQuaternion) -> SCNQuaternion {
return SCNQuaternion(
q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y,
q1.w * q2.y - q1.x * q2.z + q1.y * q2.w + q1.z * q2.x,
q1.w * q2.z + q1.x * q2.y - q1.y * q2.x + q1.z * q2.w,
q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z
)
}
import Foundation
let json = """
{
"nodes": [
{
"extensions": {
"KHR_materials_common": {
"light": 0
}
import Foundation
import SceneKit
let json = """
{
"position": [2.0, 5.0, 3.0],
"rotation": [0.0, 0.73, 0.0, 0.73]
}
""".data(using: .utf8)!
@slimlime
slimlime / ImageTools.es6
Created December 6, 2018 11:44 — forked from dcollien/ImageTools.es6
Resize Images in the Browser
let hasBlobConstructor = typeof(Blob) !== 'undefined' && (function () {
try {
return Boolean(new Blob());
} catch (e) {
return false;
}
}());
let hasArrayBufferViewSupport = hasBlobConstructor && typeof(Uint8Array) !== 'undefined' && (function () {
try {