Skip to content

Instantly share code, notes, and snippets.

View ivanalvarado's full-sized avatar

Ivan Alvarado ivanalvarado

  • Tinder
  • Los Angeles, CA
  • 18:45 (UTC -07:00)
  • LinkedIn in/ivalvara
View GitHub Profile
@ivanalvarado
ivanalvarado / UserListActivity.kt
Last active May 10, 2019 04:36
Correct implementation of Swipe-to-Refresh with LiveData.
class UserListActivity : AppCompatActivity() {
@Inject internal lateinit var viewModelFactory: ViewModelProvider.Factory
private lateinit var userListViewModel: UserListViewModel
private lateinit var swipeRefreshLayout: SwipeRefreshLayout
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
@ivanalvarado
ivanalvarado / scroll-up.js
Created August 18, 2015 17:55
Smooth Scroll Back to Top Button
/* Place this code in your JS file */
jQuery(document).ready(function($){
// browser window scroll (in pixels) after which the "back to top" link is shown
var offset = 300,
//browser window scroll (in pixels) after which the "back to top" link opacity is reduced
offset_opacity = 1200,
//duration of the top scrolling animation (in ms)
scroll_top_duration = 3500,
//grab the "back to top" link
$back_to_top = $('.cd-top');