Skip to content

Instantly share code, notes, and snippets.

🐢

Florent Destremau florentdestremau

🐢
Block or report user

Report or block florentdestremau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@florentdestremau
florentdestremau / NewPasswordType.php
Last active Sep 12, 2019
A simple User authentication setup to copy & paste into your Symfony 3.4 install
View NewPasswordType.php
<?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;
@florentdestremau
florentdestremau / space-backup.sh
Created Mar 21, 2018
Script used to backup a psql database to AWS or Digital Ocean Cloud
View space-backup.sh
#!/bin/bash
DATETIME=`date +%y%m%d-%H_%M_%S`
DST=$1
DATABASE=$2
days=30
EXPORT_CMD="pg_dump $DATABASE -F p > /backup/$DATABASE-dump.sql"
echo "$EXPORT_CMD"
showhelp(){
@florentdestremau
florentdestremau / createswap.sh
Created Mar 15, 2018
Create annd activate a 1G swap file on a Digital Ocean ubuntu 16.04
View createswap.sh
sudo swapon --show
free -h
sudo fallocate -l 1G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
free -h
@florentdestremau
florentdestremau / boxfile.yml
Last active Mar 9, 2018
Sample nanobox configuration for a PHP symfony website with node dependencies
View boxfile.yml
run.config:
cache_dirs:
- vendor
- node_modules
engine: php
engine.config:
runtime: php-7.1
extensions:
- pdo_pgsql
- bcmath
View MediumUserType.php
<?php
namespace AppBundle\GraphQL\Type;
use AppBundle\Entity\User;
use Misd\PhoneNumberBundle\Templating\Helper\PhoneNumberFormatHelper;
use Youshido\GraphQL\Config\Object\ObjectTypeConfig;
use Youshido\GraphQL\Execution\ResolveInfo;
use Youshido\GraphQL\Field\Field;
@florentdestremau
florentdestremau / install.sh
Last active Sep 7, 2018
Initial setup on a thinkpad X260. Manually installing Chrome and Phpstorm aside. Download and run
View install.sh
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 / command.php
Created Feb 17, 2017
Simple symfony command to read a csv file in project root
View command.php
<?php
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int|null
*/
public function execute(InputInterface $input, OutputInterface $output)
{
$file = $input->getArgument('file');
@florentdestremau
florentdestremau / button.html
Last active Jan 4, 2017
Bootstrap hack to make a Confirm / Cancel button group. See the width: 4% -> 4 times the width of the first one
View button.html
<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>
View RCTScrollView.m
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTScrollView.h"
@florentdestremau
florentdestremau / cleanup.sh
Last active Jun 6, 2016
Clean up your git branches towards remote
View cleanup.sh
git fetch origin --prune
git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d
You can’t perform that action at this time.