Skip to content

Instantly share code, notes, and snippets.

View artemisia-absynthium's full-sized avatar

Cristina De Rito artemisia-absynthium

View GitHub Profile
@artemisia-absynthium
artemisia-absynthium / activity.xml
Created April 18, 2017 10:47
Layout with EditText
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
@artemisia-absynthium
artemisia-absynthium / MyActivity.java
Created May 22, 2017 08:25
Cloud Endpoints init
MyApi.Builder builder = new MyApi.Builder(new NetHttpTransport(), new AndroidJsonFactory(), null)
.setApplicationName("<my package name>")
.setRootUrl(<my root URL>)
.setGoogleClientRequestInitializer(new MyApiRequestInitializer(<my API key>));
@artemisia-absynthium
artemisia-absynthium / UIColor.swift
Created July 25, 2017 13:43
Useful iOS extensions
extension UIColor {
func toHex() -> String {
var r:CGFloat = 0
var g:CGFloat = 0
var b:CGFloat = 0
var a:CGFloat = 0
getRed(&r, green: &g, blue: &b, alpha: &a)
let rgb:Int = (Int)(r*255)<<16 | (Int)(g*255)<<8 | (Int)(b*255)<<0
@artemisia-absynthium
artemisia-absynthium / AndroidManifest.xml
Last active November 19, 2022 10:34
Android Exoplayer fullscreen feature
...
<activity
android:name=".FullscreenVideoActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme" />
...
@artemisia-absynthium
artemisia-absynthium / Data+Extension.swift
Created September 28, 2024 15:16
Byte array pretty print
import Foundation
extension Data {
func toString() -> String {
if let string = String(data: self, encoding: .utf8) {
return string
} else {
return map { String(format: "%02X", $0) }.joined()
}
}