Skip to content

Instantly share code, notes, and snippets.

@creativepsyco
creativepsyco / test.dart
Created September 29, 2022 15:15
plaid_linking_test
import 'dart:convert';
void main() {
final uri = Uri.parse(
'plaidlink://connected?public_token=public-sandbox-83f5f6ce-0689-4c53-b92a-6982542c7818&account_id=bnogd7QqKmsq87VmKLVRfZNZleJL37cNApgv1&account_mask=0000&account_name=Plaid%20Checking&account_subtype=checking&account_type=depository&accounts=%5B%7B%22_id%22%3A%22bnogd7QqKmsq87VmKLVRfZNZleJL37cNApgv1%22%2C%22meta%22%3A%7B%22name%22%3A%22Plaid%20Checking%22%2C%22number%22%3A%220000%22%7D%2C%22subtype%22%3A%22checking%22%2C%22type%22%3A%22depository%22%7D%2C%7B%22_id%22%3A%22mxwb1EZPj8UWjKvmRevGFDMDGmxqjECMBZR3z%22%2C%22meta%22%3A%7B%22name%22%3A%22Plaid%20Saving%22%2C%22number%22%3A%221111%22%7D%2C%22subtype%22%3A%22savings%22%2C%22type%22%3A%22depository%22%7D%2C%7B%22_id%22%3A%22y1R5mBzpE8fKrzwVNJwafzbzV3qnrZuWVRkvX%22%2C%22meta%22%3A%7B%22name%22%3A%22Plaid%20Credit%20Card%22%2C%22number%22%3A%223333%22%7D%2C%22subtype%22%3A%22credit%20card%22%2C%22type%22%3A%22credit%22%7D%5D&institution_id=ins_5&institution_name=Citibank%20Online&link_se
@creativepsyco
creativepsyco / post-curl
Created March 5, 2012 18:02
POST request Via CURL in MAC OS X
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"userid": "mohit", "password":"password"}' http://mmedwebdemo.ddns.comp.nus.edu.sg:8080/comp.nuhs.jaxb/api/usr/login
@creativepsyco
creativepsyco / location_plugin.leak
Created October 12, 2020 10:49
Location Plugin Leak
D/LeakCanary: ​
┬───
│ GC Root: Global variable in native code
├─ android.location.LocationManager$GnssStatusListenerTransport instance
│ Leaking: UNKNOWN
│ Retaining 6839 bytes in 64 objects
│ ↓ LocationManager$GnssStatusListenerTransport.mGnssNmeaListener
│ ~~~~~~~~~~~~~~~~~
├─ com.lyokone.location.FlutterLocation$3 instance
@creativepsyco
creativepsyco / build.gradle
Created May 7, 2014 03:21
Gist for creating Dex file for class files in Android Library
/**
* The Task Below uses the Dex Tool to create classes.dex file for the archive
* This dex file can be then be loaded at runtime to prevent the 64K Dalvik Method Limit
*/
import org.apache.tools.ant.taskdefs.condition.Os
android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals(com.android.builder.BuilderConstants.DEBUG)) {
return; // Skip debug builds.
}
@creativepsyco
creativepsyco / BaseButton.java
Last active June 1, 2018 05:41
Custom Button Widget which applies a ripple onto buttons above API > 21 and normal state list selectors for API < 21. Also you can set the corner radius.
package com.mohitkanwal.framework.control.base;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.RippleDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.StateListDrawable;
@creativepsyco
creativepsyco / upload.cpp
Created December 3, 2012 18:04
Upload File + Callback
#include <stdio.h>
#include <iostream>
#include <string>
#include <curl/curl.h>
using namespace std;
static string data;
size_t writeCallback(char *buf, size_t size, size_t nmemb, void *up)
{
@creativepsyco
creativepsyco / HackFB.diff
Last active July 26, 2017 02:40
Facebook Android SDK 3.6.0 OAuth using embedded Web View
diff --git i/facebook-android-sdk-3.6.0/facebook/src/com/facebook/widget/WebDialog.java w/facebook-android-sdk-3.6.0/facebook/src/com/facebook/widget/WebDialog.java
index 70ac868..c2c9af0 100644
--- i/facebook-android-sdk-3.6.0/facebook/src/com/facebook/widget/WebDialog.java
+++ w/facebook-android-sdk-3.6.0/facebook/src/com/facebook/widget/WebDialog.java
@@ -17,6 +17,7 @@
package com.facebook.widget;
import android.annotation.SuppressLint;
+import android.app.AlertDialog;
import android.app.Dialog;
@creativepsyco
creativepsyco / HighlightRadioButton.java
Created October 4, 2013 06:02
HighlightRadionButton with two state list drawable
public class HighlightedImageRadioButton extends RadioButton {
private Drawable buttonDrawable;
public HighlightedImageRadioButton(Context context) {
super(context);
}
@creativepsyco
creativepsyco / phonegap_imgur_uploader.js
Created June 25, 2012 00:46
Imgur + Phonegap image uploader
// Author: creativepsyco
// More info here; http://api.imgur.com/resources_anon
// Allows only 50 uploads per client.
// GLOBAL VARS
var API_KEY = "YOUR_API_KEY"; // Developer key for imgur
var pictureSource = null;
var destinationType = null;
// Only png and jpg files are supported
// image data should be in base64 encoded stream
//
@creativepsyco
creativepsyco / LocationInputScreen.java
Created January 19, 2016 03:46
Get account info from the phone. Requires ACCOUNT Permission in the manifest.
Account[] accounts = AccountManager.get(getView().getContext()).getAccounts();
Set<String> emailSet = new HashSet<>();
for (Account account : accounts) {
if (EMAIL_PATTERN.matcher(account.name).matches()) {
emailSet.add(account.name);
}
}
getView().txtPlaceName.setAdapter(new ArrayAdapter<>(getView().getContext(),
android.R.layout.simple_dropdown_item_1line, new ArrayList<>(emailSet)));