Skip to content

Instantly share code, notes, and snippets.

View artyuum's full-sized avatar
🎯
Focusing

Dynèsh Hassanaly artyuum

🎯
Focusing
View GitHub Profile
@lenybernard
lenybernard / XliffFixerCommand.php
Created January 26, 2017 22:35
Symfony console command to parse xliff files to add or update missing id attribute
<?php
namespace AppBundle\Command;
use Doctrine\ORM\EntityManager;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@jameswomack
jameswomack / gulp.namespaces.js
Created May 5, 2015 16:17
Using Namespaces in Gulp 4
/*
* Gulp augmentation
*/
function getTasks(){
return gulp._registry._tasks;
}
function getTaskNamesInNamespace(namespace){
var tasks = getTasks();
var taskNames = Object.keys(tasks);
@runbiscuit
runbiscuit / deploy-syncthing.md
Last active March 4, 2019 15:52
Syncthing is 🚀

deploy-syncthing

Everyone knows it. Syncthing is the best way to sync your files. Comes with local discovery, too! Best thing ever.

🚀

Install is easy. Too easy.

@danielpuglisi
danielpuglisi / fuck-you-postgres.sh
Created November 11, 2014 09:06
Fuck You Postgres
#!/bin/bash
#
# Fix postgres after OSX crashed
pg_resetxlog /usr/local/var/postgres
rm /usr/local/var/postgres/postmaster.pid
pg_resetxlog /usr/local/var/postgres
pg_resetxlog -f /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@Magicalex
Magicalex / service-rtorrent.sh
Last active March 28, 2020 23:49
script init.d/rtorrent
#!/usr/bin/env bash
# Dépendance : screen, killall et rtorrent
### BEGIN INIT INFO
# Provides: <username>-rtorrent
# Required-Start: $syslog $network
# Required-Stop: $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
@michelt
michelt / reunion_districts.json
Last active June 25, 2020 11:57
Villes, quartiers et codes postaux de la Réunion
[
{
"name": "Les Avirons",
"postcode" : "97425",
"city" : "Les Avirons"
},
{
"name": "Bagatelle",
"postcode" : "97441",
"city" : "Sainte-Suzanne"
<?php
function array_keys_multi(array $array)
{
$keys = array();
foreach ($array as $key => $value) {
$keys[] = $key;
if (is_array($array[$key])) {
$keys = array_merge($keys, array_keys_multi($array[$key]));
@bhaktaraz
bhaktaraz / PostController.php
Last active November 7, 2020 15:16
Symfony Event Listener to Increase Post View Count
<?php
/**
* Created by PhpStorm.
* User: bhaktaraz
* Date: 8/24/15
* Time: 9:51 AM
*/
namespace BRB\Bundle\PostBundle\Controller;
@ajgarlag
ajgarlag / DecisionController.php
Last active May 28, 2021 15:56
Simple trikoder/oauth2-bundle decision flow
<?php
//src/Controller/DecisionController.php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\UriSigner;
use App\EventListener\SignedAuthorizationRequestSubscriber;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
<?php
declare(strict_types = 1);
namespace App\EventSubscriber;
use App\Exception\interfaces\ClientErrorInterface;
use App\Security\UserTypeIdentification;
use App\Utils\JSON;
use Doctrine\DBAL\DBALException;
use Doctrine\ORM\ORMException;