Skip to content

Instantly share code, notes, and snippets.

@johnpaulmanoza
johnpaulmanoza / day_range.swift
Created October 18, 2023 12:06
Number to Day of the Week
func solution(startAtDay: String, num: Int) -> String? {
let days: [String] = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
guard days.contains(startAtDay) else { return nil }
let index = (days.firstIndex(of: startAtDay) ?? 0) + 1
let value = index + num
let normalizedNo = (value - 1) % 7 + 1
switch normalizedNo {
case 1:
@johnpaulmanoza
johnpaulmanoza / actions_index.js
Last active February 21, 2020 01:39
features/resto/resto-stats
/*
* Created by John Paul Manoza on Fri Nov 22 2019
*
* Copyright (c) 2019 _______. All rights reserved.
*/
import moment from 'moment';
import { AsyncStorage } from 'react-native';
@johnpaulmanoza
johnpaulmanoza / pattern.playground
Last active August 29, 2015 14:27
Collatz Sequence Longest Chain Number
// Playground - noun: a place where people can play
import UIKit
var million = 1000000
var bestLength = 0
var bestNumber = 0
var number = 0
@johnpaulmanoza
johnpaulmanoza / GPUImageFourInputFilter.h
Created April 13, 2015 06:06
GPUImage Add Four Input Filter
#import <GPUImageThreeInputFilter.h>
extern NSString *const kGPUImageFourInputTextureVertexShaderString;
@interface GPUImageFourInputFilter : GPUImageThreeInputFilter
{
GPUImageFramebuffer *fourthInputFramebuffer;
GLint filterFourthTextureCoordinateAttribute;
GLint filterInputTextureUniform4;