Skip to content

Instantly share code, notes, and snippets.

View Grafikart's full-sized avatar
🏠
Working from home

Jonathan Grafikart

🏠
Working from home
View GitHub Profile
@Grafikart
Grafikart / donuts.js
Created November 28, 2013 19:04
Donnuts !
var circleSegment = function(centerX, centerY, radius, startAngle, endAngle) {
var PI = Math.PI,
cos = Math.cos,
sin = Math.sin
var startRadians = startAngle * PI / 180,
endRadians = endAngle * PI / 180,
largeArc = ((endRadians - startRadians) % (PI * 2)) > PI ? 1 : 0
@Grafikart
Grafikart / sendmail.mc
Created January 1, 2015 20:37
/etc/mail/sendmail.mc pour Free.fr
define(`SMART_HOST',`smtp.free.fr')
GENERICS_DOMAIN(localhost.localdomain localhost)dnl
FEATURE(`genericstable')dnl
MASQUERADE_AS(`free.fr')dnl
FEATURE(masquerade_envelope)dnl
@Grafikart
Grafikart / gist:a753044d9bfaf622b257
Created April 22, 2015 13:21
Envoy.blade.php pour CakePHP
@servers(['web' => 'tuto@localhost'])
@setup
$dir = "/home/tuto";
$dirlinks = ['tmp/cache/models', 'tmp/cache/persistent', 'tmp/cache/views', 'tmp/sessions', 'tests', 'logs'];
$filelinks = ['config/app.php'];
$releases = 3;
$remote = false;
$shared = $dir . '/shared';
@Grafikart
Grafikart / backup.sh
Created July 7, 2015 18:42
Backup.sh (ruby)
#!/usr/bin/env ruby
require 'date'
servers = {
"hostname" => "directory_name",
"hostname" => "directory_name",
"hostname" => "directory_name",
"hostname" => "directory_name",
"hostname" => "directory_name"
}
@Grafikart
Grafikart / startup.sh
Last active April 3, 2017 00:30
Basic Server
#!/bin/bash
###
# Ce fichier sert à construire un serveur de test (pour les tutoriels) rapidement
# NE PAS UTILISER EN PROD !
###
# Variables
export DEBIAN_FRONTEND=noninteractive
@Grafikart
Grafikart / .spacevim
Last active August 24, 2017 06:49
.spacevim
" Use exclude option if you don't want the full Layer,
" e.g., Layer 'better-defaults', { 'exclude': 'itchyny/vim-cursorword' }
function! Layers()
" Default layers, recommended!
Layer 'fzf'
Layer 'unite'
Layer 'airline'
Layer 'better-defaults'
Layer 'syntax-checking'
@Grafikart
Grafikart / AppCitiesCommand.php
Created May 2, 2017 09:37
Import des villes depuis EUCircos
<?php
namespace AppBundle\Command;
use AppBundle\Entity\Departement;
use AppBundle\Entity\Region;
use AppBundle\Entity\Ville;
use Doctrine\ORM\EntityManager;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
@Grafikart
Grafikart / handbrake.json
Created July 2, 2018 15:42
Preset Handbrake
{
"PresetList": [
{
"AudioCopyMask": [
"copy:aac",
"copy:ac3",
"copy:dtshd",
"copy:dts",
"copy:mp3",
"copy:truehd",
@Grafikart
Grafikart / DOMAnimation.js
Last active September 24, 2024 07:45
Permet d'animer des éléments HTML
class DOMAnimations {
/**
* Masque un élément avec un effet de repli
* @param {HTMLElement} element
* @param {Number} duration
* @returns {Promise<boolean>}
*/
static slideUp (element, duration = 500) {
return new Promise(function (resolve, reject) {
element.style.height = element.offsetHeight + 'px'
@Grafikart
Grafikart / fetchApi.ts
Last active August 17, 2022 12:33
OpenApiFetch.ts
import { paths } from "../types/generated-schema";
/**
* Utility types
*/
// Filtre un objet en retirant les clefs qui ne satisfont pas la condition C
type Filter<T, C> = Pick<
T,
{
[Key in keyof T]: T[Key] extends C ? Key : never;