Last active
August 4, 2017 23:43
-
-
Save CarloAntonio/6b9d8a2090e03b12d6bbf46b9fd3e238 to your computer and use it in GitHub Desktop.
Example
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
# Use Gists to store entire functions | |
class QuickSort | |
def self.sort!(keys) | |
quick(keys,0,keys.size-1) | |
end | |
private | |
def self.quick(keys, left, right) | |
if left < right | |
pivot = partition(keys, left, right) | |
quick(keys, left, pivot-1) | |
quick(keys, pivot+1, right) | |
end | |
keys | |
end | |
def self.partition(keys, left, right) | |
x = keys[right] | |
i = left-1 | |
for j in left..right-1 | |
if keys[j] <= x | |
i += 1 | |
keys[i], keys[j] = keys[j], keys[i] | |
end | |
end | |
keys[i+1], keys[right] = keys[right], keys[i+1] | |
i+1 | |
end | |
end |
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
<!--Give an imageview a circular foreground--> | |
<!--Requires dependencies--> | |
<!--compile 'com.android.support:appcompat-v7:23.1.1'--> | |
<!--compile 'com.android.support:design:23.1.1'--> | |
<!--compile 'com.android.support:cardview-v7:23.1.1'--> | |
<android.support.v7.widget.CardView | |
android:layout_width="80dp" | |
android:layout_height="80dp" | |
android:elevation="12dp" | |
android:id="@+id/view2" | |
app:cardCornerRadius="40dp" | |
android:layout_centerHorizontal="true" | |
android:innerRadius="0dp" | |
android:shape="ring" | |
android:thicknessRatio="1.9"> | |
<ImageView | |
android:layout_height="80dp" | |
android:layout_width="match_parent" | |
android:id="@+id/imageView1" | |
android:src="@drawable/test_pic" | |
android:layout_alignParentTop="true" | |
android:layout_centerHorizontal="true"> | |
</ImageView> | |
</android.support.v7.widget.CardView> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment