Skip to content

Instantly share code, notes, and snippets.

View Aximem's full-sized avatar

Maxime Charruel Aximem

  • Montpellier, France
View GitHub Profile
@Aximem
Aximem / DegradedMode.swift
Last active April 28, 2021 17:10
Classe to manage safely requests / Store them if it generates an error and send back when connexion came back or when user choose
//
// DegradedMode.swift
//
// Created by Maxime Charruel on 25/07/2017.
// Copyright © 2017 Maxime Charruel. All rights reserved.
//
// DegradedMode allow you to sent safely requests and prevent error cases (e.g. timeout, connexion
// issues, ...).
// When a request failed, it is stored in UserDefault and send back it when user choose to or
// automatically when connexion come back
@rd13
rd13 / .swift
Last active September 11, 2022 17:00
Copy database file from bundle to documents in Swift 3
func copyDatabaseIfNeeded() {
// Move database file from bundle to documents folder
let fileManager = FileManager.default
let documentsUrl = fileManager.urls(for: .documentDirectory,
in: .userDomainMask)
guard documentsUrl.count != 0 else {
return // Could not find documents URL
@nepsilon
nepsilon / git-change-commit-messages.md
Last active April 24, 2024 06:30
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@danvbe
danvbe / 1-Explanations.md
Last active April 21, 2023 15:39
A way to integrate FosUserBundle and HWIOAuthBundle

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.