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.Nullable; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
import butterknife.ButterKnife; | |
/** | |
* Created by brandon on 12/9/15. | |
*/ | |
public abstract class ButterKnifeViewHolder<T> extends RecyclerView.ViewHolder { | |
public ButterKnifeViewHolder(View itemView) { |
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 UIKit | |
class Barcode { | |
class func fromString(string : String, barcodeMode: BarcodeMode) -> UIImage? { | |
let data = string.dataUsingEncoding(NSASCIIStringEncoding) | |
let filter = CIFilter(name: barcodeMode.filterName) | |
filter?.setValue(data, forKey: "inputMessage") | |
guard let outputImage = filter?.outputImage else { | |
return UIImage() |
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/bash | |
for var in "$@" | |
do | |
filename="${var%.*}" | |
extension="${var##*.}" | |
sips --resampleHeightWidth 75 75 "$var" --out tabbar_"$filename"@3x."$extension" | |
sips --resampleHeightWidth 50 50 "$var" --out tabbar_"$filename"@2x."$extension" | |
sips --resampleHeightWidth 25 25 "$var" --out tabbar_"$filename"."$extension" | |
done |
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.graphics.Bitmap | |
import android.graphics.Color | |
import com.google.zxing.BarcodeFormat | |
import com.google.zxing.EncodeHintType | |
import com.google.zxing.MultiFormatWriter | |
import com.google.zxing.WriterException | |
import com.google.zxing.common.BitMatrix | |
object BarcodeUtil { | |
@Throws(WriterException::class) |
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
brando:kotlinsample brandon$ javap ServerResponse.class | |
Compiled from "ServerResponse.kt" | |
public final class com.brandonwever.android.kotlinsample.ServerResponse { | |
public final java.lang.String getMessage(); | |
public final void setMessage(java.lang.String); | |
public final int getStatusCode(); | |
public final void setStatusCode(int); | |
public final java.lang.String getBody(); | |
public final void setBody(java.lang.String); | |
public com.brandonwever.android.kotlinsample.ServerResponse(java.lang.String, int, java.lang.String); |
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
fun Int.pxToDp(): Int = (this / Resources.getSystem().displayMetrics.density).toInt() | |
fun Int.dpToPx(): Int = (this * Resources.getSystem().displayMetrics.density).toInt() |
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
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
String platform = Theme.of(context).platform.toString(); | |
return new Scaffold( | |
appBar: new AppBar( | |
title: new Text(widget.title), | |
), | |
body: new Center( | |
child: new Column( |
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
class MyHomePage extends StatefulWidget { | |
MyHomePage({Key key, this.title}) : super(key: key); | |
final String title; | |
@override | |
_MyHomePageState createState() => new _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
int _counter = 0; | |
void _incrementCounter() { | |
setState(() { |
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
class MainViewModel : ViewModel() | |
class MainActivity : AppCompatActivity() { | |
lateinit var viewModel: MainViewModel | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) |
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
class MainActivity : AppCompatActivity() { | |
lateinit var viewModel: MainViewModel | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java) |
OlderNewer