Skip to content

Instantly share code, notes, and snippets.

View menny's full-sized avatar

Menny Even Danan menny

View GitHub Profile
@menny
menny / verify_appstore_in_app.php
Last active February 15, 2024 14:45
How to verify in-app purchases from AppStore and Market in PHP code (server-side)
function verify_app_store_in_app($receipt, $is_sandbox)
{
//$sandbox should be TRUE if you want to test against itunes sandbox servers
if ($is_sandbox)
$verify_host = "ssl://sandbox.itunes.apple.com";
else
$verify_host = "ssl://buy.itunes.apple.com";
$json='{"receipt-data" : "'.$receipt.'" }';
//opening socket to itunes

Keybase proof

I hereby claim:

  • I am menny on github.
  • I am menny (https://keybase.io/menny) on keybase.
  • I have a public key ASAMK-AR6-FswpVJ2DALxjQcOVy8zcaT3xndSDjXSI5KHgo

To claim this, I am signing this object:

@menny
menny / git.md
Last active February 12, 2019 20:45
git cheatsheet

SpotiGit Cheat-Sheet

General

rebasing local branch from origin git pull --rebase if rebasing from a different remote branch git pull --rebase origin master

most of the time, after pull, you’ll need to update the submodules

@menny
menny / benchmark_git_status_pref.sh
Last active January 28, 2019 19:21
git status pref script
#!/bin/bash
command -v gtime >/dev/null 2>&1 || { echo >&2 "GNU time is required. Install it through 'brew install gnu-time'. Aborting."; exit 1; }
command -v rs-git-fsmonitor >/dev/null 2>&1 || { echo >&2 "rs-git-fsmonitor is required. Read https://github.com/jgavris/rs-git-fsmonitor#installation for how to install. Aborting."; exit 1; }
if [[ "${USER}" != "root" ]]; then
echo "Run this script as root, since we need to call dtruss during the script."
exit 1
fi
public EdgeEffect(Context context) {
final Resources res = context.getResources();
mEdge = res.getDrawable(R.drawable.overscroll_edge);
mGlow = res.getDrawable(R.drawable.overscroll_glow);
@menny
menny / AndroidManifest_API3.xml
Created December 10, 2013 16:01
Gists for 2013-12-10-multi_API_level_release post
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.menny.android.anysoftkeyboard"
android:versionCode="112"
android:versionName="20131030">
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="3"
android:maxSdkVersion="3">
</uses-sdk>
private static void unbindDrawable(Drawable d) {
if (d != null)
d.setCallback(null);
}
@menny
menny / InnerClassSnippet.java
Last active December 12, 2015 08:59
Android Memory Leaks OR Different Ways to Leak
public class AnySoftKeyboard extends InputMethodService {
private static final class KeyboardUIStateHanlder extends Handler {
//This will NOT be counted as a reference!
private final WeakReference<AnySoftKeyboard> mKeyboard;
public KeyboardUIStateHanlder(AnySoftKeyboard keyboard) {
mKeyboard = new WeakReference<AnySoftKeyboard>(keyboard);
}
@menny
menny / AndroidDumpHprof.java
Last active December 12, 2015 01:08
Android Memory Leaks OR The Different Ways to Leak
File extFolder = Environment.getExternalStorageDirectory();
File target = new File(extFolder, "ask_mem_dump.hprof");
Debug.dumpHprofData(target.getAbsolutePath());
@menny
menny / .buckconfig.yaml
Last active November 6, 2015 19:01
Buck examples
[buildfile]
includes = //DEFS