Skip to content

Instantly share code, notes, and snippets.

View binho's full-sized avatar

Cleber Santos binho

View GitHub Profile
public void validateApp()
{
try {
HttpPost request = new HttpPost("http://binho.net/p/teste.json");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(6);
nameValuePairs.add(new BasicNameValuePair("user_email", "positivo@positivo.com.br"));
nameValuePairs.add(new BasicNameValuePair("user_password", "123456"));
nameValuePairs.add(new BasicNameValuePair("application_id", APP_ID));
nameValuePairs.add(new BasicNameValuePair("device_id", obtemID()));
@binho
binho / nodejs80
Created March 2, 2013 00:35
rodar nodejs na porta 80 junto com apache
<VirtualHost cabine.la:80>
ServerAdmin contato@cabine.la
ServerName www.cabine.la
ServerAlias cabine.la
DocumentRoot /var/www/cabine
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
@binho
binho / debug_objc.m
Last active December 19, 2015 18:08
debug no objctive-c do nome do arquivo e linha
NSLog(@"[%s:%s:%d]", __FUNCTION__, __FILE__, __LINE__);
@binho
binho / android.sh
Last active December 30, 2015 05:59
Gerar chave para validação Android
# generate key example
keytool -genkey -v -keystore maxwal.keystore -alias maxwal -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Maxwal, OU=Maxwal, S=São Paulo, C=BR"
@binho
binho / vertical_block.html
Created January 21, 2014 10:24
bloqueia site na vertical
<!-- CSS -->
<style type="text/css">
/* verifica se esta na vertical ou horizontal */
#aviso-vertical { display: none; background:red; color:white; padding:20px; margin-top:100px; }
#aviso-vertical p { text-align:center; font-family: 'Trebuchet MS'; margin-left: -295px; font-size:22px; }
@media only screen and (orientation:portrait) {
#container { display:none; }
#aviso-vertical { display:block; }
}
@media only screen and (orientation:landscape) {
@binho
binho / download-subtitles.py
Last active September 1, 2016 19:52
Download subtitles using subliminal lib (https://github.com/Diaoul/subliminal)
#!/usr/bin/python
# -*- coding: utf-8 -*-
from datetime import timedelta
from babelfish import Language
from subliminal import download_best_subtitles, region, save_subtitles, scan_videos
import sys
import os
"""
@binho
binho / localization-report.py
Last active September 22, 2016 12:47
Localization Report
#!/usr/bin/python
# -*- coding: utf-8 -*-
import fnmatch
import sys
import os
num_strings_base = 0
strings_on_base = []
#!/bin/bash
DIRECTORY=$1
echo "------------------------------"
echo "Passed Resources with xcassets folder argument is <$DIRECTORY>"
echo "------------------------------"
XC_ASSETS="$(find "$DIRECTORY" -name '*.xcassets')"
for xcasset in $XC_ASSETS; do
echo "-- 📦 XC Asset: $xcasset"
@binho
binho / viewModelTest.m
Created December 21, 2016 12:48
Testing view model in XCTest
#import <XCTest/XCTest.h>
#import "Person.h"
#import "PersonViewModel.h"
@interface SimpleMVVMTests : XCTestCase
@property (nonatomic) NSString *salutation;
@property (nonatomic) NSString *fullName;
@property (nonatomic) NSDate *birthDate;
@binho
binho / fibo_objc.m
Created December 26, 2016 11:51
Fibonnaci Objective-C (Returns an array)
- (NSArray *)fibonnaci:(NSNumber *)number {
NSMutableArray *array = [NSMutableArray new];
for (int i = 0; i < [number intValue]; i++) {
if (i < 2) {
[array addObject:@(i)];
} else {
int fib = ([array[i-1] intValue] + [array[i-2] intValue]);
[array addObject:@(fib)];
}