Skip to content

Instantly share code, notes, and snippets.

try {
JSONObject jsonObject = new JSONObject("{\"pop_up\":{\"message\":\"Download a FREE game!\",\"conversion_id\":\"4f9ecd02b23e5a00080000fa\",\"bid\":22,\"links\":[{\"rel\":\"clicks\",\"href\":\"https://www.revmob.com/api/v4/conversions/4f9ecd02b23e5a00080000fa/clicks.json\"}]}}");
JSONObject popUp = jsonObject.getJSONObject("pop_up");
JSONArray links = popUp.getJSONArray("links");
JSONObject firstLink = links.getJSONObject(0);
String href = firstLink.getString("href");
System.out.println("::::: PROFIT! "+href);
} catch (JSONException e) {
e.printStackTrace();
}
@casidiablo
casidiablo / not_interesting.user.js
Created April 20, 2012 14:27
Hides interesting notes in Google+
// ==UserScript==
// @name Hides Interesting (Spanish Only)
// @include https://plus.google.com/*
// @version 1.0
// ==/UserScript==
(function () {
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (/Interesante en Google+/i.test (link.innerHTML) ){
import java.util.*;
public class Dummy {
private static final Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
static {
map.put(120, Arrays.asList(1));
map.put(121, Arrays.asList(2, 3));
map.put(122, Arrays.asList(4, 5, 6));
// 0 - 0,0 | 1 - 1,0 | 2 - 1,1,
// etc.
@casidiablo
casidiablo / .gitignore
Created March 25, 2012 20:38
Generic .gitignore
.DS_Store
gen
out
bin
*.iml
*.ipr
*.iws
target
tmp
~apklib*
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
INSERT INTO "top_names"SELECT 1 AS '_id', 'Jacob' AS 'name', 1 AS 'rank', 1 AS 'gender' UNION SELECT 2,'Ethan',2,1 UNION SELECT 3,'Michael',3,1 UNION SELECT 4,'Jayden',4,1 UNION SELECT 5,'William',5,1 UNION SELECT 6,'Alexander',6,1 UNION SELECT 7,'Noah',7,1 UNION SELECT 8,'Daniel',8,1 UNION SELECT 9,'Aiden',9,1 UNION SELECT 10,'Anthony',10,1 UNION SELECT 11,'Joshua',11,1 UNION SELECT 12,'Mason',12,1 UNION SELECT 13,'Christopher',13,1 UNION SELECT 14,'Andrew',14,1 UNION SELECT 15,'David',15,1 UNION SELECT 16,'Matthew',16,1 UNION SELECT 17,'Logan',17,1 UNION SELECT 18,'Elijah',18,1 UNION SELECT 19,'James',19,1 UNION SELECT 20,'Joseph',20,1 UNION SELECT 21,'Gabriel',21,1 UNION SELECT 22,'Benjamin',22,1 UNION SELECT 23,'Ryan',23,1 UNION SELECT 24,'Samuel',24,1 UNION SELECT 25,'Jackson',25,1 UNION SELECT 26,'John',26,1 UNION SELECT 27,'Nathan',27,1 UNION SELECT 28,'Jonathan',28,1 UNION SELECT 29,'Christian',29,1 UNION SELECT 30,'Liam',30,1 UNION SELECT 31,'Dylan',31,1 UNION SELECT 32,'Landon',32,1 UNION SELECT 33,
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
/**
* @author cristian
*/
public class MultiServer {
public static void main(String[] args) throws IOException {
import android.content.Context;
import android.support.v4.content.AsyncTaskLoader;
import com.codeslap.scanner.util.L;
import java.util.List;
public abstract class ListLoader<T> extends AsyncTaskLoader<List<T>> {
public static final String TAG = ListLoader.class.getSimpleName();
private List<T> mList;
private final List<T> mCache;
@casidiablo
casidiablo / build.xml
Created January 23, 2012 14:35
Necessary files to build from ant
<?xml version="1.0" encoding="UTF-8"?>
<project name="EL-APP-CODE-QUE-SE-USA-EN-LA-PLATAFORMA" default="help">
<loadproperties srcFile="local.properties"/>
<property file="ant.properties"/>
<loadproperties srcFile="project.properties"/>
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
unless="sdk.dir"
/>
<import file="${sdk.dir}/tools/ant/build.xml"/>
@casidiablo
casidiablo / pom.xml
Created January 19, 2012 14:25
pom.xml para la persistencia
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>police-scanner</groupId>
<artifactId>police-scanner</artifactId>
<version>1.0</version>