Skip to content

Instantly share code, notes, and snippets.

View ricdex's full-sized avatar
🎯
Focusing

Ricardo Avila ricdex

🎯
Focusing
  • BCP
  • Peru
View GitHub Profile
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_module modules/mod_proxy.so
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/</context-root>
</jboss-web>
PUT /api/device_tokens/FE66489F304DC75B8D6E8200DFF8A456E8DAEACEC428B427E9518741C92C6660 HTTP/1.1
Authorization: Basic <application authorization string>
Content-Type: application/json
{
"alias": "your_user_id",
"tags": [
"tag1",
"tag2"
],
@ricdex
ricdex / gist:8c7cda76292c184394cf
Last active September 19, 2015 14:59
encontrar clases por anotaciones
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Execute {
String target() default "";
}
@ricdex
ricdex / playbook-install-jdk8.yml
Created January 13, 2016 16:42 — forked from andershedstrom/playbook-install-jdk8.yml
Ansible playbook for installing Oracle Java 8 on CentOS
---
- hosts: app
remote_user: vagrant
sudo: yes
vars:
download_url: http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
download_folder: /opt
java_name: "{{download_folder}}/jdk1.8.0_05"
java_archive: "{{download_folder}}/jdk-8u5-linux-x64.tar.gz"
int padding = 0; // offset from edges of the map in pixels
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(mGroundOverlay.getBounds(), padding);
mMap.animateCamera(cu);
@ricdex
ricdex / animar un atributo
Created March 18, 2016 14:49
Un atributo (margin, padding) animado en el tiempo para android
ValueAnimator varl = ValueAnimator.ofInt(150);
varl.setDuration(400);
varl.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float d = mRecyclerView.getContext().getResources().getDisplayMetrics().density;
@ricdex
ricdex / modificar imagen
Created March 18, 2016 14:50
Modificar imagen en android para que pese menos
BitmapFactory.Options options1 = new BitmapFactory.Options();
options1.inSampleSize = 5;
Bitmap bitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.mapa0x, options1);
BitmapDescriptor descriptor1 = BitmapDescriptorFactory.fromBitmap(bitmap1);
@ricdex
ricdex / gist:39ac3f9c6ec2094711ed
Created March 28, 2016 20:02
SseEmitter con Spring
@RequestMapping("/helloCount")
SseEmitter mine() {
final SseEmitter sseEmitter = new SseEmitter();
Observable.just(1,2,3,4,5,6,7,8,9,10)
.map(t -> t + t)
.observeOn(Schedulers.computation())
.subscribe(new Subscriber<Integer>() {