Skip to content

Instantly share code, notes, and snippets.

View ShawnPreval97's full-sized avatar

Shawn Preval ShawnPreval97

View GitHub Profile
@ShawnPreval97
ShawnPreval97 / Code.gs
Created December 5, 2021 01:27 — forked from benbjurstrom/Code.gs
PurgeOldEmails
/*
|--------------------------------------------------------------------------
| PurgeOldEmails
|--------------------------------------------------------------------------
| https://gist.github.com/benbjurstrom/00cdfdb24e39c59c124e812d5effa39a
|
*/
// Purge messages automatically after how many days?
var DELETE_AFTER_DAYS = 7
@ShawnPreval97
ShawnPreval97 / Scaner.swift
Created August 23, 2018 05:48 — forked from asharijuang/Scaner.swift
Scanner QR Code
//
// ScanerVC.swift
// DokumenAsli
//
// Created by asharijuang on 3/18/18.
// Copyright © 2018 kodejs. All rights reserved.
//
import UIKit
import AVFoundation
@ShawnPreval97
ShawnPreval97 / gist:d2a58f1a98443f13b7410def87946784
Created August 21, 2018 20:05 — forked from patelrohan/gist:4352890
Put UISearchBar in Navigation Controller
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"Literature";
if (searchText.length > 0) {
[searchBar setShowsCancelButton:YES];
searchBar.text = searchText;
[self searchLiteraturesWithName:searchText];
}
[self.navigationController.navigationBar setTintColor:[UIColor primaryBarColor]];
@ShawnPreval97
ShawnPreval97 / AwesomeViewController.swift
Created June 23, 2018 14:59 — forked from thomaskioko/AwesomeViewController.swift
How to dynamically style custom cells in the UICollectionViewController
class AwesomeViewController: UICollectionViewController {
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize
{
let cellSpacing = CGFloat(1) //Define the space between each cell
let leftRightMargin = CGFloat(0) //If defined in Interface Builder for "Section Insets"
let numColumns = CGFloat(3) //The total number of columns you want
let totalCellSpace = cellSpacing * (numColumns - 1)
let screenWidth = UIScreen.mainScreen().bounds.width // Get the width of the screen.
@ShawnPreval97
ShawnPreval97 / modal.swift
Created June 21, 2018 03:40 — forked from BrandonShega/modal.swift
Modal View Controller with constraints
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
var str = "Hello, playground"
class MainViewController: UIViewController {
let button: UIButton = {
//
// RPMultipleImagePickerViewController.m
//
// Created by Renato Peterman on 17/08/14.
// Copyright (c) 2014 Renato Peterman. All rights reserved.
//
#import "RPMultipleImagePickerViewController.h"
@interface RPMultipleImagePickerViewController ()

UICollectionView Simple Template

import UIKit

class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
    
    @IBOutlet weak var collectionView: UICollectionView!
    
    override func viewDidLoad() {
//
// LibraryViewController.swift
// WIMB
//
// Created by Gil Felot on 16/03/16.
// Copyright © 2016 gfelot. All rights reserved.
//
import UIKit
import Parse
import UIKit
class EditingComponentsContainer: ComponentView {
let collectionView: UICollectionView
let layout = UICollectionViewFlowLayout()
let components: [ComponentView]
init(components: [ComponentView]) {
@ShawnPreval97
ShawnPreval97 / UIView+Ext.swift
Created June 18, 2018 04:06 — forked from kocoai/UIView+Ext.swift
[add subview and fill] add subview and fill #tags: uiview
func addSubviewAndFill(subview: UIView, edgeInsets: UIEdgeInsets = UIEdgeInsets.zero) {
self.addSubview(subview)
subview.translatesAutoresizingMaskIntoConstraints = false
self.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-(\(edgeInsets.left))-[view]-(\(edgeInsets.right))-|", metrics: nil, views: ["view": subview]))
self.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-(\(edgeInsets.top))-[view]-(\(edgeInsets.bottom))-|", metrics: nil, views: ["view": subview]))
}