Skip to content

Instantly share code, notes, and snippets.

View mfdeveloper's full-sized avatar
🕹️
Creating games and mobile apps, every day!

Felipe Michel mfdeveloper

🕹️
Creating games and mobile apps, every day!
View GitHub Profile
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)
}
@Korilakkuma
Korilakkuma / headless-webaudio.js
Last active February 24, 2022 15:04
Web Audio API Library (https://github.com/Korilakkuma/XSound) on Headless Chrome
'use strict';
const chrome = require('chrome-remote-interface');
const ChromeLauncher = require('chrome-launcher').Launcher;
function launchChrome() {
const launcher = new ChromeLauncher();
return Promise.resolve(launcher);
}
@nieldeokar
nieldeokar / SimpleVibrateDemoActivity.java
Last active September 1, 2023 11:04
Android Vibrate & VibrationEffect class demo Usage
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;
/*
@Macrow
Macrow / gist:99e2be7208dd42d76c0be8556dc785b0
Created May 24, 2017 17:00
Android, RxJava and Retrofit: Wait for multiple network calls to finish
[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:
@midnightcodr
midnightcodr / main.js
Created April 11, 2017 02:20
inquirer with async/await
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
}
})
@dimroc
dimroc / spec_view_helpers.rb
Last active May 4, 2018 02:29
Easily use view helpers in specs with `h.number_to_currency`
module ViewHelpers
def h
ViewHelper.instance
end
class ViewHelper
include Singleton
include ActionView::Helpers::NumberHelper
include ApplicationHelper
end

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. 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
@DavidWells
DavidWells / aligning-images.md
Last active February 20, 2026 21:50
Guide to aligning images in github readme.md files. https://davidwells.io/snippets/how-to-align-images-in-markdown

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@nepsilon
nepsilon / gitignore.md
Last active July 9, 2024 19:14
Understand what .gitignore rule is ignoring your files — First published in fullweb.io issue #54

Understand what .gitignore rule is ignoring your files

Ready to commit, you fire your git status and you don’t see your files 🤔.

Use this command to ask Git what rule is causing this ignore:

$ git check-ignore -v filename

For instance to see what rule ignores tests.pyc:

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# 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