Skip to content

Instantly share code, notes, and snippets.

@Mouerr
Mouerr / move-photos.js
Created February 13, 2021 12:02 — forked from kentcdodds/move-photos.js
Just a script I wrote to get my downloaded Google Photos into the right place.
const path = require('path')
const fs = require('fs')
const execSync = require('child_process').execSync
if (!process.argv[2] || !process.argv[3]) {
throw new Error('you did not pass the source and destination paths')
}
const searchPath = path.join(process.cwd(), process.argv[2])
const destination = path.join(process.cwd(), process.argv[3])
@Mouerr
Mouerr / UserController.php
Created June 3, 2020 19:17
multi for symfony
<?php
namespace App\Controller;
use App\Entity\Profile;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use mysql_xdevapi\Exception;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
private static function recurseCopy($src, $dst)
{
$dir = opendir($src);
@mkdir($dst, 0777, true);
while (false !== ($file = readdir($dir))) {
if (($file !== '.') && ($file !== '..')) {
if (is_dir($src.'/'.$file)) {
self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
} else {
copy($src.'/'.$file, $dst.'/'.$file);
@Mouerr
Mouerr / Login.php
Created January 15, 2020 09:26 — forked from kunicmarko20/Login.php
Symfony OAuth with Leage OAuth2 library
<?php
declare(strict_types=1);
namespace App;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
use League\OAuth2\Client\Provider\Google as GoogleProvider;