Skip to content

Instantly share code, notes, and snippets.

View aaronj1335's full-sized avatar
🤠

Aaron Stacy aaronj1335

🤠
View GitHub Profile
@aaronj1335
aaronj1335 / find_globals.md
Last active May 25, 2023 17:11
finding global variables

good unit tests framesworks in javascript will throw errors when you leak global variables. it can be massively difficult to trace down the offending lines of code in a large application. a quick and effective fix is to add the attached bit of javascript at the beginning of your application and open your debugger (chrome dev tools, firebug, node debugger, etc.).

you'll get a break point at the error and it's easy to fix from there.

@aaronj1335
aaronj1335 / interactive_plot.py
Created May 6, 2022 20:33
code to plot some time series data with a vertical rule and hover box with the data point values
data['Date'] = data['Date'].map(lambda d: f'{d}')
data = data.melt('Date')
# display(data)
line = altair.Chart(data).mark_line().encode(
x=altair.X('Date:T', axis=altair.Axis(labelAngle=50, labelSeparation=10,
format='%Y-%m-%d')),
y=altair.Y('value', title=None, axis=altair.Axis(format='$,f')),
color='variable',
)
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import java.io.PrintWriter
import java.net.HttpURLConnection
import java.net.ServerSocket
import java.net.URL
import java.nio.CharBuffer
import java.util.concurrent.Executors
data class Request(val line: String, val headers: List<String>, val body: String)
/* global Application, ObjC, $ */
/**
* repozish.js
*
* this is an example of using os x yosemite's "JavaScript for Automation":
*
* https://developer.apple.com/library/prerelease/mac/releasenotes/interapplicationcommunication/rn-javascriptforautomation/index.html
*
* it repositions some windows based on some position settings. you can run
Inferred annotations: @org.jetbrains.annotations.Nullable
The following documentation urls were checked:
http://localhost:63342/1gck1kgde1bq1jkkt1ut91iupxep3mqkann1b/Android%20Studio%20Javadoc%20Bug/play-services-tasks-17.0.1-javadoc.jar/com/google/android/gms/tasks/Task.html#addOnCompleteListener(com.google.android.gms.tasks.OnCompleteListener)
http://localhost:63342/1gck1kgde1bq1jkkt1ut91iupxep3mqkann1b/Android%20Studio%20Javadoc%20Bug/play-services-tasks-17.0.1-javadoc.jar/com/google/android/gms/tasks/Task.html#addOnCompleteListener-com.google.android.gms.tasks.OnCompleteListener-
Edit API docs paths
Gradle: com.google.android.gms:play-services-tasks:17.0.1@aar
------
FILE: WrappedInt.class
------
// class version 52.0 (52)
// access flags 0x31
public final class WrappedInt {
// access flags 0x12
private final I int
@aaronj1335
aaronj1335 / viterbi.pseudo
Last active April 6, 2018 07:56
sequential viterbi algorithm pseudocode
% use viterbi to calculate observation probability
%
% T: array of observations, length `t`
% S: array of states, length `m` (start and end states omitted for clarity)
% V: observations, length `n`
% A(m, m): state transition probability distribution
% B(m, n): observation probability distribution
function viterbi_obs(T, S, A, B)
V = zeros(t, m)
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc
dist
class GuardedSafetyNetClient {
private final SafetyNetClient client;
private GuardedSafetyNetClient(Context context) {
client = SafetyNet.getClient(context);
}
public static SafetyNetClient getClient(Context context) {
return new GuardedSafetyNetClient(context);
}
package com.bontouch.testlocationbug;
import android.Manifest;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.annotation.NonNull;