Skip to content

Instantly share code, notes, and snippets.

View giusecapo's full-sized avatar
🚀
Delivering amazing digital products

Giuseppe Capoluongo giusecapo

🚀
Delivering amazing digital products
View GitHub Profile
{
"Salute": {
"icon": "👩‍⚕️",
"data": []
},
"Gelaterie": {
"icon": "🍦",
"data": [
{
"name": "Gelateria K2",
@giusecapo
giusecapo / server.js
Created October 16, 2019 13:17
Setup for CRUD project
// Import Libraries
var express = require('express');
var session = require('express-session')
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
var passport = require('passport')
, LocalStrategy = require('passport-local').Strategy;
var cors = require('cors')
// ENV file with config
@giusecapo
giusecapo / MyCustomCell.swift
Created July 12, 2019 07:47
Custom View for Self-sizing cell
import UIKit
class MyCustomCell: UICollectionViewCell {
// mainView is my custom parent view, that contains every other component of the cell
@IBOutlet weak var mainView: UIView!
override func awakeFromNib() {
super.awakeFromNib()
@giusecapo
giusecapo / ViewControllerParent.swift
Last active July 12, 2019 07:46
Self-sizing UICollectionView cells
import UIKit
class ViewController: UIViewController {
// CollectionView from Storyboard
@IBOutlet weak var myCollectionView: UICollectionView!
override func viewDidLoad() {
super.viewDidLoad()
myCollectionView.delegate = self
@giusecapo
giusecapo / app.js
Created July 9, 2019 09:07
Create custom PFFile with Amazon AWS Cloudfront
var express = require('express');
var app = express();
var Parse = require("parse/node");
var bodyParser = require('body-parser');
const pug = require('pug');
var multer = require('multer');
var upload = multer({ dest: __dirname + '/tmp/' });
@giusecapo
giusecapo / ShowEverywhere.swift
Last active August 24, 2017 08:40
A swift function to show a view or a view controller everywhere. Useful if you need to show a view from outside of a controller!
class ShowEverywhere{
var view: UIView?
var viewController: UIViewController?
init(view: UIView){
self.view = view
self.viewController = nil
}
@giusecapo
giusecapo / MergeClips.swift
Last active June 30, 2017 10:43
Merge multiple video clips
// Mark: - Merge Videos and export Finalized Video
private func merge(clips: [Clip]){
let composition = AVMutableComposition()
let trackID = kCMPersistentTrackID_Invalid
let videoTrack = composition.addMutableTrack(withMediaType: AVMediaTypeVideo, preferredTrackID: trackID)
//let audioTrack = composition.addMutableTrack(withMediaType: AVMediaTypeAudio, preferredTrackID: trackID)
var totalTime = kCMTimeZero