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 / 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));
@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.....: dede.exe@gmail.com
#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 / 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 / temperaturas.swift
Last active September 10, 2015 04:04
Kelvin / Celcius / Fahrenheit
//
//temperaturas.swift
//Autor....: dede.exe
//E-mail...: dede.exe@gmail.com
//Descrição: Convertendo temperaturas em Swift
//
class Medida
{
var valor : Float = 0.0
@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 / 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 / DicionaryJoinString.swift
Created November 27, 2015 17:26
Convert a dictionary to string joining each key/value for a keyValueToken and mark each group by another token
extension Dictionary {
func joinKeyValuesFor(keyValueToken : String, groupedByToken:String ) -> String
{
var str = ""
for (key, value) in self
{
if str != ""
{
@dedeexe
dedeexe / gist:23a5365ddec90974d050
Created March 5, 2016 03:28 — forked from oliland/gist:5416438
An example of using CIFilters to mess with UIViews on iOS.
- (void)viewDidLoad
{
[super viewDidLoad];
// Great tutorial: http://www.raywenderlich.com/22167/beginning-core-image-in-ios-6
// Official docs: https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Conceptual/CoreImaging/ci_intro/ci_intro.html#//apple_ref/doc/uid/TP30001185-CH1-TPXREF101
// Alt-click on function names for more!
// Make any old label, with our frame set to the view so we know it's there.
UILabel *label = [[UILabel alloc] initWithFrame:self.view.frame];
@dedeexe
dedeexe / StringMaskFormatter.swift
Last active July 12, 2019 11:34
Simples And Fast String Mask Formatter.
//
// StringMaskFormatter.swift
// StringMaskFormatter
//
// Created by dede.exe on 10/07/16.
// It's totally base on article : "http://vojtastavik.com/2015/03/29/real-time-formatting-in-uitextfield-swift-basics/"
// And I don't mind if the original author should allow me(or not) to publish it :)... But I'll keep the reference
//
import UIKit
import UIKit
public class ResearchButton : UIButton {
private var markView : UIView!
private var circlePath : UIBezierPath!
private var circleLayer : CAShapeLayer!
public var borderWeight : CGFloat = 2