Skip to content

Instantly share code, notes, and snippets.

View fangzhzh's full-sized avatar
🎯
Focusing

zhangzhenfang fangzhzh

🎯
Focusing
View GitHub Profile
@halcyonmobiledev
halcyonmobiledev / observable-extension.txt
Last active October 2, 2021 18:09
Data Binding observables and Kotlin
// with just a simple extension function for the Data Binding ObservableField
inline fun <R> ObservableField<R>.observe(crossinline callback: (R) -> Unit) {
this.addOnPropertyChangedCallback(object : Observable.OnPropertyChangedCallback() {
override fun onPropertyChanged(p0: Observable?, p1: Int) {
callback(get())
}
})
}
...
@Aidanvii7
Aidanvii7 / SparseArrayExtensions.kt
Last active December 17, 2019 14:48
A collection of extension functions for Android's SparseArray
package com.aidanvii.extensions
import android.util.SparseArray
import java.util.*
val SparseArray<*>.max: Int get () = size() - 1;
inline fun <V> SparseArray<V>.forEachValue(action: (V) -> Unit): SparseArray<V> {
for (index in 0..max) {
val key = keyAt(index)
@devunwired
devunwired / FlickerActivity.java
Created December 22, 2016 22:27
Quick Android Things demo using ObjectAnimator to animate the brightness of a PWM output. This example uses a BounceInterpolator to create a flickering effect on an LED (like a candle).
/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@fangzhzh
fangzhzh / setupvim.sh
Created November 26, 2015 14:53
setup vim for new environment
cd ~
git clone git@github.com:fangzhzh/.vim.git
ln -s ~/.vim/.vimrc ~/.vimrc
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
d ~/.vim/bundle/YouCompleteMe && ./install.py --clang-completer
@staltz
staltz / introrx.md
Last active July 6, 2024 17:07
The introduction to Reactive Programming you've been missing
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active July 6, 2024 20:09
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active June 13, 2024 10:59
A badass list of frontend development resources I collected over time.
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@valpackett
valpackett / ohlife_to_evernote.py
Created July 19, 2012 13:28
OhLife to Evernote importer
# works only on Mac OS X with Evernote desktop client installed
# download the ohlife plaintext export and pipe it to this script
# eg. $ cat ~/Downloads/ohlife_2012blablabla.txt | python ohlife_to_evernote.py
# don't forget to change the notebook title if it's not "Journal"
from pipes import quote
import sys
import os
buf = ''