Skip to content

Instantly share code, notes, and snippets.

View mendesbarreto's full-sized avatar
🏠
Working from home

Douglas Mendes Barreto mendesbarreto

🏠
Working from home
View GitHub Profile
@mendesbarreto
mendesbarreto / CVSHelper
Created November 25, 2014 14:04
CVS Reader in C++
#ifndef __CVS__HELPER__H
#define __CVS__HELPER__H
#include <exception>
#include <string>
#include <iostream>
#include <sstream>
class CSVRow
{
@mendesbarreto
mendesbarreto / ASingleton.cs
Created November 26, 2014 15:12
Abstract class for easy Singleton in Unity3d
using UnityEngine;
namespace AquelaFrameWork.Core
{
/// <summary>
///
///
/// This class was build to make easy to get a Singleton class in the Unity Engine System.
///
/// If would you want a single instance of a specific class, extends this class and get access from it by the static function "Instance"
@mendesbarreto
mendesbarreto / RSSReader
Created December 1, 2014 21:36
Read a Blogs RSS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Syndication;
using System.Xml;
static int Main(string[] args)
{
XmlTextReader reader = new XmlTextReader("http://your.com/feed/");
@mendesbarreto
mendesbarreto / CameraSizeHandler
Created December 2, 2014 18:57
This helps calculate the orthographic camera size in the Unity3D
public class CameraSizeHandler : MonoBehaviour {
//public Camera cam;
// Use this for initialization
void Start ()
{
Resolution res = Screen.currentResolution;
Camera cam = this.gameObject.GetComponent<Camera>();
@mendesbarreto
mendesbarreto / GeneratorType.swift
Created July 1, 2016 14:49
Generator Protocol
public protocol GeneratorType {
associatedtype Element
public mutating func next() -> Self.Element?
}
@mendesbarreto
mendesbarreto / CoolGenerator.swift
Created July 1, 2016 14:56
Swift Cool Generator
// Coolest class ever
class CoolGenerator: GeneratorType {
typealias Element = String
let collCount: Int
private var count: Int = 0
init( collCount: Int ) {
self.collCount = collCount
}
@mendesbarreto
mendesbarreto / PrefixGenerator.swift
Last active February 25, 2019 07:18
Exemplo how to use GeneratorType
/// Prefix Class Generator
class StringPrefixGenerator: GeneratorType {
typealias Element = String
let string: String
var offset: String.Index
init(string:String) {
self.string = string
self.offset = string.startIndex
}
@mendesbarreto
mendesbarreto / ngrokService.sh
Created February 11, 2017 18:52
Script to start Ngrok at raspberry every boot
#! /bin/sh
# /etc/init.d/ngrok
case "$1" in
start)
echo "Ngrok service is starting"
screen ./ngrok start -all -config /home/pi/.ngrok2/ngrok.yml
echo "Ngrok service was started"
;;
stop)
@mendesbarreto
mendesbarreto / ngrok.yml
Created February 11, 2017 18:55
Ngrok tunnels config
authtoken: *
json_resolver_url: ""
dns_resolver_ips: []
tunnels:
httpbin:
proto: http
addr: 80
bind_tls: both #Here I chose HTTP and HTTPS protocols when active the flag 'both'.
sshbin:
@mendesbarreto
mendesbarreto / KIFUITestActor.swift
Last active April 5, 2017 17:52
KIFF && Quick Helpers
//
// Created by Douglas Barreto on 06/01/17.
// Copyright (c) 2017 Carrefour Comercio e Industria Ltda. All rights reserved.
//
import KIF
import UIKit
extension KIFUITestActor {
//
// MARK: Find View