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
object WindowsRegistry { | |
/** | |
* Set value in registry | |
* | |
* @param path full path including HKey and path | |
* @param key key name or `null` for default | |
*/ | |
fun setValueInRegistry( | |
path: String, |
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
java``` | |
public class CenterZoomLayoutManager extends LinearLayoutManager { private final float mShrinkAmount = 0.15f; private final float mShrinkDistance = 0.9f; public CenterZoomLayoutManager(Context context) { super(context); } public CenterZoomLayoutManager(Context context, int orientation, boolean reverseLayout) { super(context, orientation, reverseLayout); } @Override public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) { int orientation = getOrientation(); if (orientation == VERTICAL) { int scrolled = super.scrollVerticallyBy(dy, recycler, state); float midpoint = getHeight() / 2.f; float d0 = 0.f; float d1 = mShrinkDistance * midpoint; float s0 = 1.f; float s1 = 1.f - mShrinkAmount; for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); float childMidpoint = (getDecoratedBottom(child) + getDecoratedTop(child)) / 2.f; float d = Math.min(d1, Math.abs(midpoint - childMidpoint)); float scale = s0 + (s1 - s0) * (d - d0) / (d1 - d0); child.setScaleX |
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 Snake = (function () { | |
const INITIAL_TAIL = 4; | |
var fixedTail = true; | |
var intervalID; | |
var tileCount = 10; | |
var gridSize = 400/tileCount; |
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 java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
public class Average { | |
public static void main(String[] args) { | |
ArrayList<Student> students= new ArrayList<>(); | |
Student amir = new Student(12.0, 12.5, 19.0, 20.0); | |
Student ali = new Student(15.5, 13.25, 14.0, 5.5); |