Skip to content

Instantly share code, notes, and snippets.

View Pierry's full-sized avatar
🎯
Focusing

Pierry Borges Pierry

🎯
Focusing
View GitHub Profile
@Pierry
Pierry / alphanum
Created January 30, 2014 18:56
Alphanum, organizar lista de Strings
/*
* The Alphanum Algorithm is an improved sorting algorithm for strings
* containing numbers. Instead of sorting numbers in ASCII order like
* a standard sort, this algorithm sorts numbers in numeric order.
*
* The Alphanum Algorithm is discussed at http://www.DaveKoelle.com
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
public DomainContext() : base(""){
Configuration.LazyLoadingEnable = false;
Configuration.ProxyCreationEnable = false;
}
@Pierry
Pierry / AutoMapperConfig.cs
Created October 22, 2014 11:17
AutoMapper
public class AutoMapperConfig
{
public static void RegisterMappings()
{
Mapper.Initialize(c =>
{
c.AddProfile<DomainToViewModelMappingProfile>();
c.AddProfile<ViewModelToDomainMappingProfile>();
});
}
@Pierry
Pierry / main.c
Created October 22, 2014 19:33
Verifica quantas vezes o numero N se repete na sequência M
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ctype.h>
#include <string.h>
int main()
{
void leitura(char *valor);
int varrerString(char valor);
@Pierry
Pierry / layout.xml
Last active August 29, 2015 14:08
Volley Image
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/networkImageView"
android:layout_width="150dp"
android:layout_height="170dp"
android:layout_centerHorizontal="true" />
@Pierry
Pierry / volley-string
Created November 5, 2014 16:27
Volley String
// Request a string response from the provided URL.
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// Display the first 500 characters of the response string.
etUser.setText("Response is: "+ response.substring(0,500));
}
}, new Response.ErrorListener() {
@Override
@Pierry
Pierry / volley-json.java
Created November 5, 2014 16:37
JSONObject
String url ="http://ip.jsontest.com/";
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
etUser.setText("Response :" + response.toString());
}
}, new Response.ErrorListener(){
@Override
@Pierry
Pierry / IRepositoryBase.cs
Created November 18, 2014 18:29
IRepositoryBase
public interface IRepositoryBase<TEntity> where TEntity : class
{
TEntity Add(TEntity item);
TEntity GetById(int id);
IEnumerable<TEntity> Get();
bool Update(TEntity item);
int Count();
void Dispose();
}
@Pierry
Pierry / app buidle.gradle
Last active August 29, 2015 14:10
Buidle Gradle - Root and App
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
repositories {
@Pierry
Pierry / IsConnected.java
Created November 22, 2014 17:41
IsConnected class
public static boolean is(Context context) {
try {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()) {
return true;
} else if(cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnected()){
return true;
} else {
return false;
}