Skip to content

Instantly share code, notes, and snippets.

@amineMpdam
amineMpdam / LocalNetworkPrivacyPermissionRepository.swift
Created February 13, 2026 10:56
Swift 6 Compliant Repository to Request LocalNetworkAccessPermission
import Foundation
import Network
public protocol LoggerProtocol: Sendable {
func info(_ message: String)
func error(_ message: String)
func debug(_ message: String)
}
public protocol LocalNetworkPrivacyPermissionRepositoryProtocol: Sendable {
@amineMpdam
amineMpdam / expand-collapse.java
Created May 12, 2016 17:29 — forked from ZkHaider/expand-collapse.java
Simple Expand / Collapse RecyclerView Item
public static class ExampleViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener {
private int originalHeight = 0;
private boolean isViewExpanded = false;
private YourCustomView yourCustomView
public ExampleViewHolder(View v) {
super(v);
v.setOnClickListener(this);
@amineMpdam
amineMpdam / gist:1ada3a7f51b31ae43cd4e185ca0fb5e7
Created April 23, 2016 09:29 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@amineMpdam
amineMpdam / Readme.md
Created March 1, 2016 16:33 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@amineMpdam
amineMpdam / README.md
Created February 11, 2016 21:02 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

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 password Grant 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 :