Skip to content

Instantly share code, notes, and snippets.

View nolanamy's full-sized avatar
🤫

Nolan Amy nolanamy

🤫
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nolanamy
nolanamy / ViewPagerBottomSheetBehavior.kt
Last active July 5, 2023 16:10
Fix for the "nested scroll in ViewPager in BottomSheet" issue
// must be in this package to have access to `nestedScrollingChildRef`
package com.google.android.material.bottomsheet
import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.coordinatorlayout.widget.CoordinatorLayout
import java.lang.ref.WeakReference
class ViewPagerBottomSheetBehavior<V : View>(context: Context, attrs: AttributeSet?) : BottomSheetBehavior<V>(context, attrs) {
V/REALM_JNI: --> finalize_unchecked_row -786967184
V/REALM_JNI: --> Java_io_realm_internal_UncheckedRow_nativeGetString -870263440
V/REALM_JNI: --> Java_io_realm_internal_OsSharedRealm_nativeIsClosed -339864272
--> Java_io_realm_internal_UncheckedRow_nativeGetString -870263440
--> Java_io_realm_internal_OsSharedRealm_nativeIsClosed -339864272
--> Java_io_realm_internal_UncheckedRow_nativeGetString -870263440
--> Java_io_realm_internal_OsSharedRealm_nativeIsClosed -339864272
--> Java_io_realm_internal_OsList_nativeCreate -870263440
--> Java_io_realm_internal_OsSharedRealm_nativeIsClosed -339864272
--> Java_io_realm_internal_OsSharedRealm_nativeIsClosed -339864272
/* 1 */
{
"_id" : ObjectId("57eaf642ff01db2659e2af49"),
"value" : {
"country" : "US",
"gender" : "F",
"age" : "13"
}
}
@nolanamy
nolanamy / mixpanel.js
Last active August 29, 2015 14:20 — forked from ivarvong/gist:3763494
Mixpanel raw data export
var crypto = require('crypto');
var md5 = crypto.createHash('md5');
var request = require('request');
var api_key = 'your_api_key_here';
var api_secret = 'your_api_secret_here';
var api_endpoint = 'https://data.mixpanel.com/api/2.0/';
var current_time = parseInt((new Date().getTime())/1000);
@nolanamy
nolanamy / should-around-now.js
Created April 21, 2015 22:40
Should test for date being around now
var timestampMoment = moment.unix(res.body.timestamp);
(timestampMoment.isBetween(before.subtract(1, 'second'), moment().add(1, 'second'))).should.be.true;
@nolanamy
nolanamy / hat-collisions.js
Created April 21, 2015 19:05
Check for hat() collisions
var hat = require('hat');
var _ = require('lodash');
var rack = {};
for(var i = 0; i < 1000000; i++) {
var id = hat();
rack[id] = rack[id] ? rack[id] + 1 : 1;
}
@nolanamy
nolanamy / PrettyDates.js
Last active August 29, 2015 13:57
Pretty dates
getDayName = function(day)
{
return {0:"Sunday",1:"Monday",2:"Tuesday",3:"Wednesday",4:"Thursday",5:"Friday",6:"Saturday"}[day];
};
getDayDiffString = function(now, before)
{
if((now - before) < 1000*60*60*24*5)
{
var dayDiff = now.getDay() - before.getDay();
@nolanamy
nolanamy / dotgraph.rb
Last active January 3, 2016 04:29
Graph time-based data in irb
#example data
data = [
{
:time => Time.now - 2.days,
:value => 2321.65
},
{
:time => Time.now - 1.days,
:value => 1307.98
},
function JSON2CSV(objArray) {
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
var str = '';
var line = '';
if ($("#labels").is(':checked')) {
var head = array[0];
if ($("#quote").is(':checked')) {
for (var index in array[0]) {