Skip to content

Instantly share code, notes, and snippets.

Avatar

Hans Petter Eide hanspeide

View GitHub Profile
@hanspeide
hanspeide / TimberFirebase.java
Last active May 13, 2020
Timber tree for use with Firebase Crash Reporting. Basically a copy/rewrite of Jake Wharton's CrashlyticsTree.
View TimberFirebase.java
private static class FirebaseTree extends Timber.Tree {
@Override
protected void log(int priority, String tag, String message, Throwable t) {
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
return;
}
FirebaseCrash.log(message);
if (t != null) {
View aog.js
const app = new DialogflowApp({request: request, response: response});
const INTENT_AVAILABILITY_USER_LOCATION = 'availability-user-location';
const INTENT_AVAILABILITY_USER_LOCATION_PERMISSION_RESPONSE = 'availability-user-location.response';
const ARG_ASSET_TYPE = 'asset_type';
const actionMap = new Map();
actionMap.set(INTENT_AVAILABILITY_USER_LOCATION, availabilityUserLocation);
actionMap.set(INTENT_AVAILABILITY_USER_LOCATION_PERMISSION_RESPONSE, availabilityUserLocationPermissionResponse)
View io.sh
youtube-dl -t http://www.youtube.com/watch?v=0Cv1EFhYU2M
youtube-dl -t http://www.youtube.com/watch?v=37ia7S4Lsv4
youtube-dl -t http://www.youtube.com/watch?v=3nYyApSiSLQ
youtube-dl -t http://www.youtube.com/watch?v=4fyhgHQYG1U
youtube-dl -t http://www.youtube.com/watch?v=5GIk9ABs8ww
youtube-dl -t http://www.youtube.com/watch?v=6p3i6H2oGa0
youtube-dl -t http://www.youtube.com/watch?v=7CWi_Olz0xw
youtube-dl -t http://www.youtube.com/watch?v=80hrknwD74Q
youtube-dl -t http://www.youtube.com/watch?v=Acdu2ZdBaZE
youtube-dl -t http://www.youtube.com/watch?v=AJqakuas_6g
View gist:1bd8fe5d78b0131620f5
package com.example;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerViewOnScrollListener extends RecyclerView.OnScrollListener {
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
View BaseActivity.java
public abstract class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (requestInjection()){
inject();
}
}
View gist:1344823
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8" />
</script>
</head>
<body">
View gist:1336456
$.getJSON(url,
function(data) {
var output = '';
$.each(data.query.results.item, function(i,item){
output += '<li><a href="' + item.spotify-uri-worldwide + '><img src="' + item.cover-uri + '/>' + item.artist + " " + item.title + '</a></li>';
});
$('#albumlist').append(output).listview('refresh');
});