Skip to content

Instantly share code, notes, and snippets.

View ssaurel's full-sized avatar

Sylvain Saurel ssaurel

View GitHub Profile
# Get your files that Gmail block. Warning message:
# "Anti-virus warning - 1 attachment contains a virus or blocked file. Downloading this attachment is disabled."
# Based on: http://spapas.github.io/2014/10/23/retrieve-gmail-blocked-attachments/
# Go to your emails, click the arrow button in the top right, "Show original", save to the same directory as this script.
import email
import sys
import os
if __name__ == '__main__':
@ssaurel
ssaurel / Devices.java
Created February 22, 2016 15:21
No longer maintained. Use this library instead: https://github.com/jaredrummler/AndroidDeviceNames
/*
* Copyright (C) 2015 Jared Rummler <jared.rummler@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ssaurel
ssaurel / activity_main.xml
Created November 28, 2016 09:33
Simple layout for a BMI Calculator App
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
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"
@ssaurel
ssaurel / MainActivity.java
Created November 28, 2016 09:34
Java Code for a Simple BMI Calculator
package com.ssaurel.bmicalculator;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@ssaurel
ssaurel / Player.java
Last active November 30, 2016 09:42
Java Bean for a SQLite tutorial
public class Player {
private int id;
private String name;
private String position;
private int height;
public Player() {
}
@ssaurel
ssaurel / SQLiteDatabaseHandler.java
Created November 30, 2016 09:44
SQLiteOpenHelper implementation for a SQLite Tutorial
package com.ssaurel.samples.sqlite;
import java.util.LinkedList;
import java.util.List;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
@ssaurel
ssaurel / MainActivity.java
Created November 30, 2016 09:45
Main Activity for a SQLite Tutorial
public class MainActivity extends Activity {
private SQLiteDatabaseHandler db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// create our sqlite helper class
db = new SQLiteDatabaseHandler(this);
@ssaurel
ssaurel / background.xml
Created December 5, 2016 11:26
Background for a correct Splash Screen on Android
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/colorPrimary" />
<item>
<bitmap android:src="@drawable/logo"
android:gravity="center" />
</item>
@ssaurel
ssaurel / styles.xml
Created December 5, 2016 11:27
Theme for your Splash Screen on Android
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/background</item>
@ssaurel
ssaurel / SplashActivity.java
Created December 5, 2016 11:29
SplashActivity for your Splash Screen
package com.ssaurel.splashscreen;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
/**
* Created by ssaurel on 02/12/2016.
*/