Skip to content

Instantly share code, notes, and snippets.

View dedeexe's full-sized avatar

dede.exe dedeexe

  • PuraMagia Labs
  • Brazil
View GitHub Profile
@dedeexe
dedeexe / StringBase64.swift
Last active November 25, 2015 17:33
Convert String to base64 String
extension String {
var base64 : String?
{
if let convertedData = self.dataUsingEncoding(NSUTF8StringEncoding)
{
let convertedDataBase64 = convertedData.base64EncodedDataWithOptions(NSDataBase64EncodingOptions(rawValue: 0))
let stringBase64 = String(data: convertedDataBase64, encoding: NSUTF8StringEncoding)
return stringBase64
@dedeexe
dedeexe / CustomFocusView.swift
Created November 6, 2015 10:30
Creating a custom focus view for tvOS
//
// FocusView.swift
// CustomNavigation
//
// Creating a CustomFocusView
// This code shows how to implement a custom view that can be focused in tvOS
// Just set this class as an UIView's custom class
//
import UIKit
@dedeexe
dedeexe / temperaturas.swift
Last active September 10, 2015 04:04
Kelvin / Celcius / Fahrenheit
//
//temperaturas.swift
//Autor....: dede.exe
//E-mail...: [email protected]
//Descrição: Convertendo temperaturas em Swift
//
class Medida
{
var valor : Float = 0.0
@dedeexe
dedeexe / gist:bee58e7e9894b92a42e9
Created June 23, 2015 11:02
Converting String to Float and Double
import Foundation
extension String {
func toFloat() -> Float
{
return (self as NSString).floatValue
}
func toDouble() -> Double
@dedeexe
dedeexe / format_converter.sh
Last active October 21, 2015 12:18
Converting files to UTF-8 example
#!/bin/bash
#conversor.sh
#Author.....: dede.exe
#E-mail.....: [email protected]
#Description: Convert all files to a another format
# It's not a safe way to do it...
# Just a desperate script to save my life...
# Use it such a last resort...
to_format="utf8"
@dedeexe
dedeexe / trim.cpp
Last active May 31, 2021 18:08
Trimming string in C++
#include <string>
#include <iostream>
//
//Left trim
//
std::string trim_left(const std::string& str)
{
const std::string pattern = " \f\n\r\t\v";
return str.substr(str.find_first_not_of(pattern));