This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package eu.fiskur.pennineway.tutorial; | |
import android.graphics.Color; | |
import android.os.Bundle; | |
import android.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v4.app.FragmentStatePagerAdapter; | |
import android.support.v4.view.PagerAdapter; | |
import android.support.v4.view.ViewPager; | |
import android.support.v7.app.ActionBarActivity; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class EndlessRecyclerViewScrollListener extends RecyclerView.OnScrollListener { | |
// The minimum amount of items to have below your current scroll position | |
// before loading more. | |
private int visibleThreshold = 5; | |
// The current offset index of data you have loaded | |
private int currentPage = 0; | |
// The total number of items in the dataset after the last load | |
private int previousTotalItemCount = 0; | |
// True if we are still waiting for the last set of data to load. | |
private boolean loading = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Build & extract a set of apk from an aab for a specific device and install the results on it. | |
# | |
# This needs https://github.com/google/bundletool to be available as `bundletool`. | |
# Also **exactly** one device needs to be connected to adb. | |
# Usage: installFromBundle bundle.aab | |
# optional `--extract-apks` to keep the set on your workstation as well. | |
basename=${1%%.*} | |
keystore="~/.android/debug.keystore" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use std::cell::RefCell; | |
// Ownership | |
use { | |
std::ops::Drop | |
}; | |
#[derive(Debug)] | |
struct Parent(usize, Child, Child); | |
#[derive(Debug)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use std::cell::RefCell; | |
// Ownership: Copy semantic | |
// Copy trait should not have Drop trait implemented | |
#[derive(Debug, Clone, Copy)] | |
struct Parent(usize, Child, Child); | |
#[derive(Debug, Clone, Copy)] | |
struct Child(usize); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implementing Vector | |
pub struct ToyVec<T> { | |
elements: Box<[T]>, | |
len: usize, | |
} | |
// Reference type field requires lifetime specifier | |
pub struct Iter<'vec, T> { | |
elements: &'vec Box<[T]>, | |
len: usize, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Math.blerp = function (values, x1, y1, x2, y2, x, y) { | |
let q11 = (((x2 - x) * (y2 - y)) / ((x2 - x1) * (y2 - y1))) * values[x1][y1] | |
let q21 = (((x - x1) * (y2 - y)) / ((x2 - x1) * (y2 - y1))) * values[x2][y1] | |
let q12 = (((x2 - x) * (y - y1)) / ((x2 - x1) * (y2 - y1))) * values[x1][y2] | |
let q22 = (((x - x1) * (y - y1)) / ((x2 - x1) * (y2 - y1))) * values[x2][y2] | |
return q11 + q21 + q12 + q22 | |
} |
OlderNewer