Skip to content

Instantly share code, notes, and snippets.

View meshenka's full-sized avatar
🎯
Learning #golang

Sylvain G meshenka

🎯
Learning #golang
  • Lydia App
  • Paris
View GitHub Profile
@meshenka
meshenka / metrics.go
Created November 8, 2022 19:55
prometheus metrics
// Package metric allows to create Prometheus metrics easily.
package metric
import "github.com/prometheus/client_golang/prometheus"
// DefaultHistogramBuckets provides a simple and reusable heatmap setup.
var DefaultHistogramBuckets = prometheus.LinearBuckets(0, 0.03, 67)
// Namespace is a Prometheus namespace.
type Namespace string
@meshenka
meshenka / google_authenticator.go
Created October 16, 2020 10:31 — forked from tilaklodha/google_authenticator.go
Simple Google Authenticator script in go
// Checkout the readme for this here: https://github.com/tilaklodha/google-authenticator
package main
import (
"bytes"
"crypto/hmac"
"crypto/sha1"
"encoding/base32"
"encoding/binary"
@meshenka
meshenka / Collect.php
Created July 19, 2019 15:56
onFlush v2
<?php
declare(strict_types=1);
namespace App\Accounting\Entity;
use App\Application\Annotation\Legacy;
use App\Application\Entity\Replicable;
use App\Accounting\Model\PaymentMeanInterface;
use App\Accounting\PaymentMeans;
@meshenka
meshenka / MemberProduct.php
Created July 19, 2019 09:33
onFlush Doctrine event
<?php
declare(strict_types=1);
namespace App\Membership\Entity;
use App\Application\Annotation\Legacy;
use Doctrine\ORM\Mapping as ORM;
/**
#config/packages/demo.yaml
parameters:
# see https://symfony.com/doc/current/configuration/environment_variables.html#environment-variable-processors
env(MY_DISPATCH_EVENTS): true
services:
App\Demo\DemoService:
bind:
$dispatchEvents: '%env(bool:MY_DISPATCH_EVENTS)%'
@meshenka
meshenka / Product.orm.xml
Last active February 7, 2019 10:31
Mapped Super Abstract Class
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="App\Domain\Model\Product">
<field name="name"
type="string"
@meshenka
meshenka / Product.php
Created February 6, 2019 14:03
Field Mapping issue Sf 4.2
namespace App\Domain\Model;
abstract class Product implements ProductInterface {
/**
* @var int
*/
protected $id;
/**
@meshenka
meshenka / LICENSE
Created July 19, 2016 14:07 — forked from jdennes/LICENSE
Subscribing to a Campaign Monitor list using AJAX
The MIT License (MIT)
Copyright (c) James Dennes
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@meshenka
meshenka / index.html
Created March 3, 2016 21:03 — forked from anonymous/index.html
JS Bin test transformation // source https://jsbin.com/bikeci
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="test transformation">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
@meshenka
meshenka / Actions.js
Created February 28, 2016 21:22 — forked from amcdnl/Actions.js
import { action } from 'common/utils/redux/redux';
@action
export class Actions {
static types = {
set3d: Symbol('set3d')
};
static set3d(val) {