| Method | Result |
|---|
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 android.content.Context; | |
| import android.util.Log; | |
| import android.view.LayoutInflater; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| import android.widget.BaseAdapter; | |
| import android.widget.Filter; | |
| import android.widget.Filterable; | |
| import android.widget.TextView; |
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
| /* | |
| * Copyright (C) 2006 The Android Open Source Project | |
| * | |
| * 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 |
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
| docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt |
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
| DELIMITER $$ | |
| CREATE FUNCTION `haversine` (lat1 DECIMAL(8,6), lng1 DECIMAL(8,6), lat2 DECIMAL(8,6), lng2 DECIMAL(8,6)) RETURNS DECIMAL(8,6) | |
| BEGIN | |
| DECLARE R INT; | |
| DECLARE dLat DECIMAL(30,15); | |
| DECLARE dLng DECIMAL(30,15); | |
| DECLARE a1 DECIMAL(30,15); | |
| DECLARE a2 DECIMAL(30,15); | |
| DECLARE a DECIMAL(30,15); | |
| DECLARE c DECIMAL(30,15); |
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
| @Converter(autoApply = true) | |
| public class LocalDateAttributeConverter implements AttributeConverter<LocalDate, Date> { | |
| @Override | |
| public Date convertToDatabaseColumn(LocalDate locDate) { | |
| return (locDate == null ? null : Date.valueOf(locDate)); | |
| } | |
| @Override | |
| public LocalDate convertToEntityAttribute(Date sqlDate) { |
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 android.view.View | |
| /** | |
| * Created by Thibault de Lambilly on 11/11/2017. | |
| * Help to flip visibility for a list of Views | |
| */ | |
| class DisplayHandler { | |
| enum class RuleType { FOLLOW, MIRROR } | |
| data class ViewProperty(val view: View, val rule: RuleType = RuleType.FOLLOW) |
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle
The API we are creating in this gist will follow these rules :
- The API only returns JSON responses
- All API routes require authentication
- Authentication is handled via OAuth2 with
passwordGrant Type only (no need for Authorization pages and such). - API versioning is managed via a subdomain (e.g.
v1.api.example.com)
The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :
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
| /** | |
| * Created by Thibault de Lambilly on 11/11/2017. | |
| * Functions that check several object for null state, then return their non null version | |
| */ | |
| fun <T1, T2> ifNotNull(value1: T1?, value2: T2?, bothNotNull: (T1, T2) -> (Unit)) { | |
| if (value1 != null && value2 != null) { | |
| bothNotNull(value1, value2) | |
| } | |
| } |