- Create a gist if you haven't already.
- Clone your gist:
# make sure to replace `<hash>` with your gist's hash git clone https://gist.github.com/<hash>.git # with https git clone git@gist.github.com:<hash>.git # or with ssh
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
| fun ViewPropertyAnimator.setListener(init: ViewPropertyAnimator.() -> Unit) { | |
| this.init() | |
| } | |
| inline fun ViewPropertyAnimator.onAnimationEnd(crossinline continuation: (Animator) -> Unit) { | |
| setListener(object : AnimatorListenerAdapter() { | |
| override fun onAnimationEnd(animation: Animator) { | |
| continuation(animation) | |
| } |
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 strict'; | |
| const chrome = require('chrome-remote-interface'); | |
| const ChromeLauncher = require('chrome-launcher').Launcher; | |
| function launchChrome() { | |
| const launcher = new ChromeLauncher(); | |
| return Promise.resolve(launcher); | |
| } |
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 com.example.nileshdeokar.simplevibratedemo; | |
| import android.os.Build; | |
| import android.os.VibrationEffect; | |
| import android.os.Vibrator; | |
| import android.support.annotation.RequiresApi; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.os.Bundle; | |
| import android.widget.Toast; | |
| /* |
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
| [url]https://newfivefour.com/android-rxjava-wait-for-network-calls-finish.html[/url] | |
| Android, RxJava and Retrofit: Wait for multiple network calls to finish | |
| Say you have multiple network calls you need to make–cals to get Github user information and Github user events for example. | |
| And you want to wait for each to return before updating the UI. RxJava can help you here. | |
| Let’s first define our Retrofit object to access Github’s API, then setup two observables for the two network requests above: |
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
| const inquirer = require('inquirer') | |
| const genList = (list) => { | |
| const choices = list.map((item, index) => { | |
| return { | |
| key: index, | |
| name: `${item.id}: ${item.quantity}@${item.price}`, | |
| value: item.id | |
| } | |
| }) |
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
| module ViewHelpers | |
| def h | |
| ViewHelper.instance | |
| end | |
| class ViewHelper | |
| include Singleton | |
| include ActionView::Helpers::NumberHelper | |
| include ApplicationHelper | |
| end |
This is a guide for aligning images.
See the full Advanced Markdown doc for more tips and tricks
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
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |