Skip to content

Instantly share code, notes, and snippets.

View madson's full-sized avatar
👨‍💻
Always coding

Madson Mac madson

👨‍💻
Always coding
View GitHub Profile
Como parte do processo seletivo do Elo7, gostaríamos que você fizesse uma
pequena tarefa. Conforme seu resultado daremos continuidade ao processo te
convidando para uma sessão de pair-programming.
Durante o desenvolvimento dê preferência para implementação em Android ou iOS.
O objetivo dessa tarefa é avaliar como você vai desenvolver o código em termos
de estilo, eficiência e qualidade.
Crie um projeto no seu Github para que vejamos os passos feitos através dos
@madson
madson / upgrade.rb
Created June 3, 2014 22:34
Script ruby to increment version number
#!/usr/bin/env ruby
COMMANDS = ['major', 'minor', 'patch']
regex = /^([0-9]+)\.?([0-9]*)\.?([0-9]*)/
version = ARGV[0]
command = ARGV[1]
unless ARGV.size > 1 or version =~ regex
@madson
madson / speedup.sh
Created March 17, 2014 22:54
Script to mount directories DerivedData and iPhoneSimulator in the RAM
#!/bin/bash
# set disk size for 512 MB
disksize=$((512*(512*4)))
# mounting DerivedData virtual disk
disknum=$(hdid -nomount ram://$disksize | tr -cd '[0-9]')
newfs_hfs -v DerivedData /dev/rdisk$disknum
diskutil mount -mountPoint ~/Library/Developer/Xcode/DerivedData /dev/disk$disknum
@madson
madson / uncrustify.sh
Created May 27, 2013 18:50
Process uncrustify in files
#! /bin/sh
if [ -z "$1" ]; then
echo "specify the file that contains a list of files"
exit
fi
files=$(cat $1)
for item in $files ; do
@madson
madson / matrix.c
Created May 7, 2013 14:49
matrix.c
#import <stdio.h>
#define ANSI_COLOR_GREEN "\x1b[01;32m"
#define ANSI_COLOR_RESET "\x1b[0m"
void printb(int n) {
int i;
for (i = 0; i < n; i++) {
printf("\n");
}
@madson
madson / password.pl
Created April 29, 2013 22:05
Perl script to generate encrypted password for Mac OS X.
#!/usr/bin/perl
# Gavin Brock (http://brock-family.org/gavin/perl) - June 2007
#==============================================================================#
use strict;
use warnings;
use Foundation;
#==============================================================================#
@madson
madson / uncrustify.cfg
Created April 29, 2013 22:05
My uncrustify configuration file for Objective-C.
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.3 (176)
#
# Alignment
# ---------
## Alignment
@madson
madson / captureView.m
Created December 7, 2011 00:48
Getting UIImage from UIView
- (UIImage *)captureView:(UIView *)view {
CGRect rect = [view bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, rect);
[view.layer renderInContext:ctx];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
@madson
madson / factorial.c
Created October 21, 2011 17:22
Factorial calc with C
#include <stdio.h>
int factorial(int n)
{
if (n == 0)
return 1;
return n * factorial(n-1);
}
int main() {
@madson
madson / Math.m
Created October 21, 2011 17:21
Factorial calc with objective-c
#include <Foundation/Foundation.h>
@interface Math : NSObject
+ (int)factorial:(int)n;
@end;
@implementation Math
+ (int)factorial:(int)n
{
if (n == 0)