This file contains hidden or 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 MyRecyclerViewAdapter(private val list: List<MyModel>) : RecyclerView.Adapter<MyRecyclerViewAdapter.ViewHolder>() { | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | |
val view = LayoutInflater.from(parent.context).inflate(R.layout.row_recycler, parent, false) | |
return ViewHolder(view) | |
} | |
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | |
val myModel = list[position] | |
holder.title.text = myModel.title |
This file contains hidden or 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 class KeyboardSensitiveRelativeLayout extends RelativeLayout { | |
private OnKeyboardShowHideListener listener; | |
public KeyboardSensitiveRelativeLayout(Context context) { | |
super(context); | |
} | |
public KeyboardSensitiveRelativeLayout(Context context, AttributeSet attrs) { | |
super(context, attrs); |
This file contains hidden or 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
/** | |
* Each presenter must implement this interface | |
* | |
* @param <V> View for the presenter | |
</V> */ | |
interface BaseMvpPresenter<V : BaseView> { | |
/** | |
* @return true if view is attached to presenter | |
*/ |
This file contains hidden or 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 sys,json,os, collections | |
infile = 'res.json' | |
def __main__(): | |
if (len(sys.argv) < 3): | |
print "Usage: \npython gen.py [android | ios] outfile" | |
sys.exit() | |
type = sys.argv[1] | |
if (type != "android" and type != "ios" ): |
This file contains hidden or 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
var USER = "USER" | |
var json = document.getElementById("taskboard").innerHTML.split("</script>"); | |
var data = JSON.parse(json[0].substring(55, json[0].length)) | |
function contains(list, item){ | |
var has = false | |
list.forEach(function(l){ | |
if (l == item){ | |
has = true | |
} |
This file contains hidden or 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
// Depenency graph | |
./gradlew -q dependencies app:dependencies |
This file contains hidden or 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
// Conditional string | |
android:text="@{viewModel.startButtonText ? @string/title_start_travel : @string/title_start}" | |
// Conditional visibility | |
<import type="android.view.View" /> | |
android:visibility="@{viewModel.visibility == 1 ? View.VISIBLE : View.GONE}" | |
// Non-string text | |
android:text="@{String.valueOf(data.minutes)}" |
This file contains hidden or 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
echo "1/7 Stopping nginx" | |
sudo service nginx stop | |
echo "2/7 Removing mongod.lock" | |
rm /var/lib/mongodb/mongod.lock | |
echo "3/7 Stopping mongod" | |
sudo service mongod stop | |
echo "4/7 Renewing letsencrypt" |
This file contains hidden or 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
#Switch to dev branch, pull it then come back to my current branch | |
current="$(git branch | grep \* | cut -d ' ' -f2)";git checkout dev;git pull origin dev;git checkout $current |
This file contains hidden or 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
1.Code formatting | |
On Windows: Shift + Alt + F | |
On Mac: Shift + Option + F | |
On Ubuntu: Ctrl + Shift + I | |
2.Copy line up/down | |
On Windows: Shift + Alt + Up/Down | |
On Mac: Shift + Option + Up/Down | |
On Ubuntu: Ctrl + Shift + Alt + Up/Down |