Skip to content

Instantly share code, notes, and snippets.

View PanosJee's full-sized avatar

Panos Papadopoulos PanosJee

View GitHub Profile
init([]) ->
% Start the scheduled GC job every minute. Naive!
erlang:send_after(60 * 1000, self(), {gc}),
{ok, no_state}.
handle_info({gc}, State) ->
erlang:garbage_collect(self()),
erlang:send_after(60 * 1000, self(), {gc}),
{noreply, State}.
private async void CrashUnawaitedVoidMethod(object sender, RoutedEventArgs e)
{
throw new Exception("Void Unawaited");
}
private async void GoTaskUnawaitedMethod(object sender, RoutedEventArgs e)
{
CrashUnawaitedTaskMethod();
}
private async Task CrashUnawaitedTaskMethod()
{
throw new Exception("Task Unawaited");
}
@PanosJee
PanosJee / gist:6580198
Last active December 23, 2015 04:29 — forked from anonymous/gist:5592740
-optimizationpasses 25
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-printmapping out.map
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keep class com.bugsense.** { *; }
@PanosJee
PanosJee / gist:6157043
Last active December 20, 2015 15:49
BugSense Helpshift iOS Integration example
// in didFinishLaunchingWithOptions at AppDelegate.m
[BugSenseController setErrorNetworkOperationsCompletionBlock:^() {
NSLog(@"Application crashed with errorId: %ld with an error count since last reset: %d", [BugSenseController lastCrashId], [BugSenseController crashCount]);
if ([BugSenseController crashCount] == 1) { // after every crash, customize!
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"We're sorry!"
message:@"We are aware of the crashes that you have experienced lately. Would you like to tell us more about it?"
delegate:self
cancelButtonTitle:@"No"
import stripe
import collections
from texttable import Texttable
# TODO add pagination
# I will update this gist shortly when pagination is added
stripe_customers = stripe.Customer.all(count=100)
by_status = collections.defaultdict(list)
@PanosJee
PanosJee / gist:5170020
Last active December 14, 2015 23:59
Generate Entropy UID for Android
private static String generateUid() {
// STEP 1: get time since Epoch.
// OUTPUT: timestamp in millisecond (or finer) granularity.
// RATIONALE: collision only when app is deployed at the exact same time.
final String s1 = Long.valueOf((new Date()).getTime()).toString();
// STEP 2: get an object reference.
// OUTPUT: memory address or another distinguishable object property.
// RATIONALE: very little probability for two runs to get the
// same address (debatable when in a sandbox).
@PanosJee
PanosJee / bugsense_cli.py
Last active December 14, 2015 01:18
Sample Python BugSense API SDK
# -*- coding: utf-8 -*-
"""
bugsense_cli.py
~~~~
Sample script to upload dSYMSs and access the Read API
:version: 0.1
:copyright: 2013 by bugsense.com.
"""
from urllib import quote
{
"stacktrace": [
"java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState",
"at android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1265)",
"at android.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:451)",
"at android.app.Activity.onBackPressed(Activity.java:2121)",
"at dalvik.system.NativeStart.main(Native Method)"
],
"error": {
"resolved": null,
@PanosJee
PanosJee / gist:5004739
Last active December 14, 2015 01:18
sample-bugsense-read-api-response
{
"order": "created",
"total": 1,
"filters": {
"status": "new",
"appver": null,
"tag": null,
"osver": null
},
"error": null,