Skip to content

Instantly share code, notes, and snippets.

View vnavarro's full-sized avatar

Vitor Navarro vnavarro

View GitHub Profile
@vnavarro
vnavarro / UIScrollView+ToImageExtension.swift
Last active July 30, 2021 03:31
Convert full content of scrollview as image
import UIKit
extension UIScrollView {
func toImage() -> UIImage? {
UIGraphicsBeginImageContext(contentSize)
let savedContentOffset = contentOffset
let savedFrame = frame
let saveVerticalScroll = showsVerticalScrollIndicator
@vnavarro
vnavarro / VNCameraSwitch.cs
Created May 5, 2018 15:40
A camera switcher c# script for Unity3D created using version 2017, but should work with almost any of them.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// A camera switcher. It cicles camera transform through given positions starting from a specified position walking 1 by 1.
/// It can either change or animate between positions with the specified speed.
/// </summary>
public class VNCameraSwitch : MonoBehaviour {
@vnavarro
vnavarro / Print iOS project current font names - Swift version
Last active October 19, 2017 16:59
Swift code for printing all registered fonts on iOS project
for familyName in UIFont.familyNames {
print("------------------------------")
print("Font Family Name = [\(familyName)]")
let names = UIFont.fontNames(forFamilyName: familyName as! String)
print("Font Names = [\(names)]")
}
@vnavarro
vnavarro / localnet_ip.sh
Created October 11, 2016 02:00
Get internal network ip on linux
#!/bin/sh
#From here http://askubuntu.com/questions/430853/how-do-i-find-my-internal-ip-address
#Also good reference http://askubuntu.com/questions/430853/how-do-i-find-my-internal-ip-address
#If using other mask than 8.8.8.8 change it here or pass it as param
ip route get 8.8.8.8 | awk '{print $NF; exit}'
@vnavarro
vnavarro / http_clients.md
Last active February 3, 2016 18:42
Using http clients: cURL, HTTPie, RESTY

Here you find a fast how to test of an API with cURL, HTTPie and RESTY. The API is simulated using JSON Server tool from typicode.

Install with npm npm install -g json-server

We use typicode sample json

{
@vnavarro
vnavarro / setup-pch-osx-ios.md
Last active August 29, 2015 14:15
How to create and setup a prefix header file for osx/ios
  1. In Xcode use command+n and in the file prompt select Other(either osx/ios)> PCH File.
  2. Give it a name and a target
  3. Go to the target's Build Settings and in Prefix Header config set the file path, something like this: "${PROJECT_DIR}/${PRODUCT_NAME}/PrefixHeader.pch"
  4. Change Precompile Prefix Header to YES Why?

Build Settings Info

@vnavarro
vnavarro / PropFullNotify.snippet
Last active August 29, 2015 14:07
Visual Studio Snippets for Property with NotifyOfPropertyChange
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Notified Property C# - WinPhone</Title>
<Author>Vitor Navarro</Author>
<Description>Full Property shortcut with NotifyOfPropertyChange for WinPhone using C#</Description>
<Shortcut>propfullnotify</Shortcut>
</Header>
@vnavarro
vnavarro / automation
Created January 20, 2014 20:11
Things to place in my vagrant/machine automation
#Postgres
##Configuração
[Check status no stackoverflow](http://stackoverflow.com/questions/7975414/check-status-of-postgresql-server-mac-os-x)
export PGDATA='/usr/local/var/postgres'
export PGHOST=localhost
alias start-pg='pg_ctl -l $PGDATA/server.log start'
alias stop-pg='pg_ctl stop -m fast'
alias show-pg-status='pg_ctl status'
alias restart-pg='pg_ctl reload'