Skip to content

Instantly share code, notes, and snippets.

View odedhb's full-sized avatar
🤨

Oded Breiner odedhb

🤨
View GitHub Profile
@odedhb
odedhb / GraphemeToPhoneme.java
Created April 2, 2014 12:22
A simple function that maps english letters (grapheme) to their sounds (phoneme).
package com.robinlabs.voca;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
/**
* Created by oded on 3/31/14.
@odedhb
odedhb / ValueSortedMap.java
Created April 8, 2014 11:43
A map that keeps sorted by its value
package com.blogspot.odedhb.later;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.TreeMap;
/**
* Created by oded on 1/20/14.
*/
@odedhb
odedhb / gist:79d9ea471c10c040245e
Created January 6, 2015 11:24
Generate android Palette color from String
public int calculateColorBase() {
String opacity = "#ff"; //opacity between 00-ff
String hexColor = String.format(
opacity + "%06X", (0xeeeeee & name.hashCode()));
return Color.parseColor(hexColor);
}
public int calculateColor() {
@odedhb
odedhb / EmojiSource.java
Created September 14, 2015 11:36
Emoji source - a helper JAVA class that converts emojis from a json file to a string you can use in android. This was created to be implemented in http://wheredatapp.com, android's greatest search engine.
package com.nextstagesearch.sources;
import android.content.Context;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
@odedhb
odedhb / WatermarkTransformation.java
Last active June 9, 2018 18:10
Watermark Transformation for the Picasso image loading library (https://github.com/square/picasso). The transformation will add the text you provide in the constructor to the image. This was created to be implemented in http://wheredatapp.com, android's greatest search engine.
package com.nextstagesearch.design;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.support.v7.graphics.Palette;
import com.squareup.picasso.Transformation;
@odedhb
odedhb / WhereDat_search_response.json
Last active September 20, 2015 08:11
WhereDat Search API response
{
"apps": [
{
"category": "Social",
"rating": 3.9948248863220215,
"updated": 1435805622,
"created": 1427510074,
"icon_url": "https://lh3.googleusercontent.com/ZZPdzvlpK9r_Df9C3M7j1rNRi7hhHRvPhlklJ3lfi5jk86Jd1s0Y5wcQ1QgbVaAP5Q=w300",
"title": "Facebook",
"download_url": "https://play.google.com/store/apps/details?id=com.facebook.katana",
@odedhb
odedhb / WhereDat_app_data_request.json
Last active September 20, 2015 08:21
WhereDat app data request
{
"packages": [
"com.pixmix.mobileapp",
"com.nextstagesearch"
]
}
@odedhb
odedhb / WhereDat_app_data_response.json
Created September 20, 2015 08:20
WhereDat app data API response
{
"apps": [
{
"category": "Productivity",
"rating": 4.5,
"updated": 1436741473,
"created": 1431028391,
"icon_url": "https://lh3.googleusercontent.com/q5pFGfXKZejowwcmlJl7M1IXGHVM4Zq_IjPpYb7zgkUFXO3QnZ2LyeOUUhMPaKPkJ3gR=w300",
"title": "WhereDat Beta",
"package": "com.nextstagesearch",
@odedhb
odedhb / PermissionsHelper.java
Last active April 4, 2019 18:02
A simple class for Android Marshmallow. Showing a list of permissions, and allowing the user to change them. This was created to be implemented in http://wheredatapp.com, android's greatest search engine.
package com.nextstagesearch;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
@odedhb
odedhb / calendar.js
Last active October 7, 2016 10:51
calendar.js
var requireFromUrl = require('require-from-url');
requireFromUrl("https://rawgit.com/wanasit/chrono/master/chrono.min.js")
.on('Resolved', function (next, chrono) {
let query = '{QUERY}';
if (!query) return;
let dateResults = chrono.parse(query);
let results = [];