This file contains 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
// Easily run on `https://stephengrider.github.io/JSPlaygrounds/` | |
const reducer = (state = [], action) => { | |
switch (action.type) { | |
case 'split_string': | |
return action.payload.split(''); | |
case 'add_character': | |
return [ ...state, action.payload ]; | |
default: | |
return state; |
This file contains 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
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.VideoView; | |
public class ScalableVideoView extends VideoView { | |
private int mVideoWidth; | |
private int mVideoHeight; | |
private DisplayMode displayMode = DisplayMode.ORIGINAL; |
This file contains 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
~/Android/Sdk/platform-tools/hprof-conv ~/Downloads/dump.hprof ~/Downloads/4mat_dump.hprof |
This file contains 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
# Regular expression definitions to get frame number, and to get video duration from ffmpeg -i | |
FRAME_REGEX="frame-([0-9]*)\.jpeg" | |
LEN_REGEX="Duration: ([0-9]*):([0-9]*):([0-9]*)\.([0-9]*), start" | |
# Loops through the files passed in command line arguments, | |
# example: videotoframes video-*.mp4 | |
# or: videotoframes file1.mp4 file2.mp4 file3.mp4 | |
for vf in "$@"; do | |
video_info=$(ffmpeg -i $vf 2>&1) # Get the video info as a string from ffmpeg -i | |
[[ $video_info =~ $LEN_REGEX ]] # Extract length using reges; Groups 1=hr; 2=min; 3=sec; 4=sec(decimal fraction) |
This file contains 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
palette="/tmp/palette.png" | |
filters="fps=60,scale=1024:-1:flags=lanczos" | |
ffmpeg -i shoot.mov -vf "$filters,palettegen" -y $palette | |
ffmpeg -i shoot.mov -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y output.gif |
This file contains 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
Observable.<Integer>error(new RuntimeException("Hey, try to catch it!")) | |
.doOnError(new Action1<Throwable>() { | |
@Override | |
public void call(Throwable throwable) { | |
Log.e("TEST", "DO ON ERROR CALLBACK"); | |
} | |
}) | |
.compose(new Observable.Transformer<Integer, Integer>() { | |
@Override | |
public Observable<Integer> call(Observable<Integer> integerObservable) { |
This file contains 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 enum UpdateMode { | |
UPDATE_SIMPLE_MODE(ConnectivityMode.WIFI, ConnectivityMode.ETHERNET), | |
UPDATE_FAST_MODE(ConnectivityMode.ETHERNET) | |
} | |
public enum ConnectivityMode { | |
WIFI, | |
ETHERNET | |
} |
This file contains 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
import java.io.File; | |
import java.io.IOException; | |
import java.nio.charset.Charset; | |
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import java.util.Locale; | |
import java.util.TimeZone; | |
import okio.BufferedSource; | |
import okio.ByteString; |
This file contains 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
import android.support.annotation.IntRange; | |
import android.support.annotation.NonNull; | |
import android.text.TextUtils; | |
import com.petcube.android.helpers.Log; | |
import java.util.concurrent.TimeUnit; | |
import rx.Observable; | |
import rx.Subscriber; |
This file contains 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
String networkSSID = "Your Network SSID here"; | |
String networkPasskey = "YourNetworkPasswordHere"; | |
WifiConfiguration wifiConfiguration = new WifiConfiguration(); | |
wifiConfiguration.SSID = "\"" + networkSSID + "\""; | |
wifiConfiguration.preSharedKey = "\"" + networkPasskey + "\""; | |
WifiManager manager = (WifiManager) getSystemService(WIFI_SERVICE); | |
manager.addNetwork(wifiConfiguration); |
NewerOlder