Skip to content

Instantly share code, notes, and snippets.

View omarojo's full-sized avatar

Omar Juarez omarojo

View GitHub Profile
@omarojo
omarojo / G8AppleLogin.swift
Last active April 8, 2020 10:55
Apple Login
import Foundation
import AuthenticationServices
@available(iOS 13.0, *)
class G8AppleLogin: NSObject{
var authController: ASAuthorizationController!
override init(){
super.init()
@omarojo
omarojo / G8AspectRatio.swift
Created January 29, 2020 02:05
MetalPetal Aspect Ratio Cropping
//
// G8AspectRatio.swift
// GenerateMetal-iOS
//
// Created by Omar Juarez Ortiz on 2019-12-12.
// Copyright © 2019 Generate Software Inc. All rights reserved.
//
import Foundation
import MetalPetal
//
// G8Shaders.metal
// GenerateMetal-iOS
//
// Created by Omar Juarez Ortiz on 2019-02-25.
// Copyright © 2019 Generate Software Inc. All rights reserved.
//
#include <metal_stdlib>
#include "MTIShaderLib.h"
@omarojo
omarojo / VideoMediaInput.swift
Last active May 13, 2024 06:35
How to use MTAudioProcessingTap in Swift 4.2
//
// VideoMediaInput.swift
// GenerateMetal-iOS
//
// Created by Omar Juarez Ortiz on 2018-11-28.
// Copyright © 2018 All rights reserved.
//
import Foundation
import UIKit
@omarojo
omarojo / script.js
Created June 14, 2018 05:42
Animate an Object
// ----------- API -------------
const D = require('Diagnostics');
const Scene = require('Scene');
const FT = require('FaceTracking');
const FGestures = require('FaceGestures');
const A = require('Animation');
const R = require('Reactive');
const Time = require('Time');
var objToAnimate = Scene.root.find("plane0");
@omarojo
omarojo / ContrastShader.fsh
Created March 27, 2018 22:08
Contrast Shader (GPUImage)
varying vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform float contrast;
void main()
{
vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
gl_FragColor = vec4(((textureColor.rgb - vec3(0.5)) * contrast + vec3(0.5)), textureColor.w);
@omarojo
omarojo / blackandWhite.fsh
Created March 27, 2018 22:06
Black and White Shader (GPUImage)
precision highp float;
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
void main()
{
highp vec4 textureColor;
highp vec4 rCol;
highp vec4 gCol;
@omarojo
omarojo / UnityTriggerAnim.cs
Created November 10, 2017 11:44
Unity Trigger Animation Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
namespace Vuforia{
public class ImageTargetAnimTrigger: MonoBehaviour,
ITrackableEventHandler
{
private TrackableBehaviour mTrackableBehaviour;
//self.inputVideoData is an instanace of RawDataOutput
if let rawData = self.inputVideoData {
rawData.dataAvailableCallbackWithSize = {[weak self] dataArray, frameSize in
let numberOfBytesPerRow = frameSize.width;
let data = Data.init(bytes: dataArray)
data.withUnsafeBytes { (u8Ptr: UnsafePointer<UInt8>) -> Void in
@omarojo
omarojo / StaticPixelBuffer.swift
Created May 5, 2017 14:53
LF Custom Static Buffer
import lf
import UIKit
import XCGLogger
import AVFoundation
let sampleRate:Double = 44_100
final class LiveViewController: UIViewController {
//.....