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
@Serializable | |
data class $NAME$(override val version: String, | |
override val href: String, | |
override val attributes: $ATTRTYPE$, | |
override val items: List<$ITEMTYPE$>, | |
override val links: $LINKTYPE$): CDoc<$ATTRTYPE$, $ITEMTYPE$, $LINKTYPE$> { | |
@Serializer(forClass = $NAME$::class) | |
companion object: KSerializer<$NAME$> { | |
@ImplicitReflectionSerializer |
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
#!/bin/sh | |
palette="/tmp/palette.png" | |
filters="fps=$4,scale=$3:-1:flags=lanczos" | |
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette | |
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2 |
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
ffmpeg -i InputVideo.mp4 -vf "pad=width=1565:height=3258:x=59:y=329:color=white" padded_OutputVideo.mp4 | |
ffmpeg -i padded_OutputVideo.mp4 -i Nexus6P_full.png -filter_complex "overlay=x=0:y=0" OverlayVideo.mp4 |
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
/** | |
* Desaturate the given color int value by the provided ratio, down to a minimum of 0.2f. | |
* | |
* Note: Do not pass R.color ints, resolve the actual color int via | |
* getResources().getColor(R.color.your_color_name_here). | |
* | |
* f(x) = ( startSaturation / 1.0f * ratio ) + ( minSaturation * (1.0f - ratio) ) | |
* | |
* @param int The color value to desaturate | |
* @param float The ratio to desatrate by (0.0f - 1.0f) |
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
private void logFileStream(FileInputStream fis) { | |
BufferedReader reader = new BufferedReader(new InputStreamReader(fis)); | |
StringBuilder sb = new StringBuilder(); | |
String line = null; | |
try { | |
while ( (line = reader.readLine()) != null) { | |
sb.append(line); | |
} | |
Log.d("FILESTREAM", sb.toString()); | |
reader.close(); |
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
@Override | |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
super.onMeasure(widthMeasureSpec, heightMeasureSpec); | |
int size = 0; | |
int width = getMeasuredWidth(); | |
int height = getMeasuredHeight(); | |
if (width > height) { | |
size = height; | |
} else { |
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
/* | |
* Copyright (C) 2014 Chris Banes | |
* | |
* 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 |
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
+ (CGFloat)transitionFloat:(CGFloat)float1 toFloat:(CGFloat)float2 byRatio:(CGFloat)ratio | |
{ | |
return ( ratio * (float2 - float1) ); | |
} | |
+ (CGRect)transitionRect:(CGRect)rect1 toRect:(CGRect)rect2 byRatio:(CGFloat)ratio | |
{ | |
if (CGRectIsNull(rect1) || CGRectIsNull(rect2)) { | |
return CGRectZero; | |
} |
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
- (UILabel *)lblTitle | |
{ | |
// Check if the property isn't instantiated yet | |
if (_lblTitle == nil) { | |
_lblTitle = [[UILabel alloc] init]; | |
// Disable auto-constraints if you plan to implement your own | |
[_lblTitle setTranslatesAutoresizingMaskIntoConstraints:NO]; | |
/* Set any one time configuration properties for the label here |
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
/** | |
* {@link android.support.v4.view.ViewPager.PageTransformer} to translate / transform pages | |
* as they are slid left / right. | |
* | |
* @author michaelseifollahi | |
*/ | |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) | |
private class SlideTransformer implements PageTransformer { | |
private final float fScaleFactor; | |
NewerOlder