Skip to content

Instantly share code, notes, and snippets.

View aguilarpgc's full-sized avatar
🔥

Paul Aguilar Catari aguilarpgc

🔥
View GitHub Profile
@aguilarpgc
aguilarpgc / tic-tac-toe.js
Created July 4, 2025 21:48
simple tic-tac-toe in react
import { useState } from "react";
function Square({ value, onSquareClick }) {
return (
<button className="square" onClick={onSquareClick}>
{value}
</button>
);
}
#!/bin/bash
echo "======================"
echo "Lists of targets and configurations in the project, or the schemes in the workspace"
echo "======================"
xcodebuild -list
echo "======================"
@aguilarpgc
aguilarpgc / Extension+UICollectionViewCell.swift
Created July 5, 2021 18:59
Get cell percent visibility inside its collection view
//
// Extension+UICollectionViewCell.swift
// @aguilarpgc
//
// Created by aguilarpgc on 5/07/21.
//
import UIKit
extension UICollectionView {
@aguilarpgc
aguilarpgc / StringPEM.swift
Created October 4, 2018 15:54
extract key from PEM text
//
// StringPEM.swift
// TestPEM
//
// Created by Paul Aguilar on 10/4/18.
// Copyright © 2018 Paul Aguilar. All rights reserved.
//
import Foundation
import UIKit
import WebKit
class ViewController: UIViewController {
@IBOutlet weak var webContainer: UIView!
override func viewDidLoad() {
@aguilarpgc
aguilarpgc / fadeScrolling.swift
Created August 22, 2018 13:50
Simple fade animation at horizontal scrolling in UIScrollView
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let mod = scrollView.contentOffset.x.truncatingRemainder(dividingBy: scrollView.bounds.size.width)
let difference = abs((2 * mod / (scrollView.bounds.size.width)) - 1)
let factor = (difference * 0.5) + 0.5
self.scrollView.alpha = factor
@aguilarpgc
aguilarpgc / example.swift
Created February 3, 2018 23:58
Enum with associated values
//: Playground - noun: a place where people can play
import UIKit
struct Category1: Decodable {
let recordID : String?
let Year_when_Started : String?
let Problem_Name : String?
}
@aguilarpgc
aguilarpgc / cs:go
Last active December 20, 2016 17:47
sv_cheats 1
sv_infinite_ammo 1
sv_grenade_trajectory 1
sv_grenade_trajectory_time 10
sv_showimpacts 1
mp_autoteambalance 0
mp_buytime 1000
mp_freezetime 0
@aguilarpgc
aguilarpgc / UIFontExtension.swift
Last active March 7, 2016 21:12
font extension
import UIKit
public extension UIFont {
enum Type: String {
case Light = "Roboto-Light",
Regular = "Roboto-Regular",
Medium = "Roboto-Medium",
Thin = "Roboto-Thin",
@aguilarpgc
aguilarpgc / change_sub.py
Last active August 29, 2015 14:16
Move srt files
import sys
import re
def add_time(pattern,to_add):
first_pattern, d = pattern.split(',')
a, b, c = [int(i) for i in first_pattern.split(':')]
d = int(d)
d -= to_add
# if d < 0:
c += d / 1000