Skip to content

Instantly share code, notes, and snippets.

View florentdestremau's full-sized avatar

Florent Destremau florentdestremau

View GitHub Profile
@florentdestremau
florentdestremau / NewPasswordType.php
Last active March 10, 2023 13:17
A simple User authentication setup to copy & paste into your Symfony 3.4 install
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
@treetop1500
treetop1500 / .adding-wkhtmltopdf-to-symfony-on-platform-with-knpsnappy-bundle
Last active December 30, 2018 10:09
KNP Snappy wkhtmltopdf configuration for Platform.sh
# This file means nothing. It's just here to give the Gist a name I can understand.
# This configuration requires the KNP Snappy Bundle [https://github.com/KnpLabs/KnpSnappyBundle]
@florentdestremau
florentdestremau / boxfile.yml
Last active March 9, 2018 11:33
Sample nanobox configuration for a PHP symfony website with node dependencies
run.config:
cache_dirs:
- vendor
- node_modules
engine: php
engine.config:
runtime: php-7.1
extensions:
- pdo_pgsql
- bcmath
const log = new Proxy({}, {
get: (_, colour) => function() {
console.log(`%c ${[].slice.call(arguments).join(' ')}`, `color: ${colour}`)
}
})
// example
log.tomato('I am tomato')
log.chocolate('I am chocolate')
log.cornflowerblue('I am cornflowerblue')
@florentdestremau
florentdestremau / install.sh
Last active September 7, 2018 10:19
Initial setup on a thinkpad X260. Manually installing Chrome and Phpstorm aside. Download and run
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install git zsh tig curl vim htop vlc tlp tlp-rdw build-essential automake
# Battery management
sudo tlp start
# install node js
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
@florentdestremau
florentdestremau / button.html
Last active January 4, 2017 11:55
Bootstrap hack to make a Confirm / Cancel button group. See the width: 4% -> 4 times the width of the first one
<div class="btn-group btn-group-justified" role="group">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default btn-lg">
&times;
</button>
</div>
<div class="btn-group" role="group" style="width: 4%;">
<button type="button" class="btn btn-success btn-lg btn-block">
Confirm ?
</button>
@gp187
gp187 / webstorm-phpstorm-inotify-fix
Last active June 13, 2023 08:56
Webstorm, PHPStorm Inotify watch limit is too low
To prevent this situation it is recommended to increase the watches limit (to, say, 512K):
1. Add the following line to either /etc/sysctl.conf file or a new *.conf file (e.g. idea.conf) under /etc/sysctl.d/ directory:
fs.inotify.max_user_watches = 524288
2. Then run this command to apply the change:
sudo sysctl -p --system
And don't forget to restart your IDE.
@bekco
bekco / ResourceOwnerGrantExtension.php
Last active May 8, 2019 06:36
How to Authenticate (Facebook, Google +, Twitter etc.) users with HWIOauthBundle and FOSOauthServerBundle from iOS, Android or third party application using API.
<?php
/**
* User: bekco (Behçet Mutlu)
* Date: 17/11/16
* Time: 17:52
*/
namespace Acme\Oauth2Bundle\Oauth\Extension;
@ncuillery
ncuillery / upgrade_rn.sh
Last active March 21, 2017 09:37
Upgrade React Native on your project, using a git-like interface
# In the root directory of a project, the Git working copy must be clean:
echo "a" | react-native upgrade # Generate the current version template and overwrite all files
git add .
git commit -m "Old version" # The current version template is added to the index
npm i react-native@latest --save # Install the new version of React Native
echo "a" | react-native upgrade # Generate the new version template and overwrite all files
<?php
<<<CONFIG
packages:
- "kriswallsmith/buzz: ^0.15.0"
- "symfony/console: ^3.2@dev"
CONFIG;
// Find you token on https://api.slack.com/docs/oauth-test-tokens
use Buzz\Message\Response;