Skip to content

Instantly share code, notes, and snippets.

View appoll's full-sized avatar

Paul Anton appoll

  • Hamburg, Germany
View GitHub Profile
@appoll
appoll / gist:d863a09f25076061e881
Last active October 12, 2023 18:29
Working sample of fragment inside CoordinatorLayout
<android.support.design.widget.CoordinatorLayout 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:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
@appoll
appoll / gist:334c59398dec4703289e
Last active August 29, 2015 14:22
Static fragment with recycler view.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="de.no.no.fragments.SomeFragment">
@appoll
appoll / gist:0104ddc8a13e6de49b45
Last active August 29, 2015 14:22
Non-working sample of CardView & fragment inside CoordinatorLayout
<android.support.design.widget.CoordinatorLayout 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:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
@appoll
appoll / gist:d5811ee564dd85f55a9fa299f0d64143
Created July 23, 2018 13:33
Homography estimation normalization
### normalization so that the points have zero mean and unit standard deviation - important for numerical reasons
m = np.mean(input_points[:2], axis=1)
maxstd = max(np.std(input_points[:2], axis=1)) + 1e-9
C1 = np.diag([1/maxstd, 1/maxstd, 1])
C1[0][2] = -m[0]/maxstd
C1[1][2] = -m[1]/maxstd
input_points = np.dot(C1, input_points)
@appoll
appoll / e1.js
Created November 23, 2020 17:25
// E1: try it with an object
// 1.1 add 2 properties to the user object: one number (e.g. age) and one boolean (e.g. germanCitizenship)
// 1.2 print the person's name, age and citizenship using template literals
let user = {
firstName: "Thomas",
lastName: "Hummel"
}
console.log("The name is " + user.firstName + " and the age is " + user.age);
@appoll
appoll / e2.js
Created November 23, 2020 17:50
// E2. You are given an array of user objects:
// 2.1 Print the name of the first user in the array
// 2.2 Print the age of the last user in the array
// 2.3 Find the name of the oldest user in the array
// 2.4 Find the name of the oldest user who is also german
let user1 = {
firstName: "Paul",
lastName: "Anton",
// age:
@appoll
appoll / e3.js
Created November 23, 2020 19:01
let person = {
firstName: "Paul",
lastName: "Anton",
age: 28,
job:
{city: "Hamburg"},
bikes: ["Mountain Bike", "Road bike", "Cyclo Cross"],
minutesOnSocialMedia: [45, 65, 70, 120, 300]
}
@appoll
appoll / e0.js
Created November 25, 2020 18:02
// E0.
// 0.1 Add another property to each book object. e.g. language
// 0.2 Write a function that prints the book language.
// 0.3 Write a function that prints the book details in the language in which the book is written:
// if the language of the book is "english", print the message in english:
// "The price of the book is ... and the title is ..."
// if the language of the book is "german", print the message in german
@appoll
appoll / e1.js
Created November 25, 2020 18:38
let book1 = {
title: "Gone with the wind",
price: 30
}
let book2 = {
title: "The godfather",
price: 40
}
@appoll
appoll / e3.js
Created November 25, 2020 19:20
let books = [
{
pages: 200,
year: 2020,
author: {
firstName: "Paul",
lastName: "Anton"
},
language: "DE"