Skip to content

Instantly share code, notes, and snippets.

@Microtribute
Microtribute / rule.js
Created April 21, 2020 18:04 — forked from vktr/rule.js
Add Stripe Customer Id to Auth0 via custom rule
function (user, context, callback) {
user.app_metadata = user.app_metadata || {};
if ('stripe_customer_id' in user.app_metadata) {
context.idToken['https://example.com/stripe_customer_id'] = user.app_metadata.stripe_customer_id;
return callback(null, user, context);
}
var stripe = require('stripe')('sk_....');
var customer = {
@Microtribute
Microtribute / ffmpeg.md
Created May 5, 2020 12:39 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@font-face {
font-family: SegoeUI;
src:
local("Segoe UI Light"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2) format("woff2"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff) format("woff"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.ttf) format("truetype");
font-weight: 100;
}
@Microtribute
Microtribute / Event.php
Created August 19, 2020 12:44 — forked from jonny-no1/Event.php
NotOverlapping Symfony date period validator
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use AppBundle\Validator\Constraints\NotOverlapping;
/**
* @NotOverlapping("period")
*/
@Microtribute
Microtribute / CountryRepository.php
Created September 1, 2020 17:30 — forked from adamsafr/CountryRepository.php
Doctrine: Union with JOIN example
<?php
namespace AppBundle\Repository;
use AppBundle\Entity\Country;
use AppBundle\Entity\CountryTranslation;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\QueryBuilder;
@Microtribute
Microtribute / Math.php
Created September 4, 2020 15:32 — forked from jgrossi/Math.php
Math class from Taylor Otwell. Thanks to @brad ([email protected]) for the class content.
<?php
class Math {
/**
* The base.
*
* @var string
*/
private static $base = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@Microtribute
Microtribute / checkIsBrave.js
Created September 9, 2020 15:03 — forked from drbh/checkIsBrave.js
Reliably detect Brave Browser with native JS
// helper to find Brave in User Agent string
function isBraveAgent(userAgentResponse) {
var isBraveIndex = ~userAgentResponse.indexOf('Brave')
if (isBraveIndex < 0) {
return true
}
return false
}
// Function from Javarome
@Microtribute
Microtribute / Main.elm
Created October 12, 2020 19:11 — forked from pablohirafuji/Main.elm
Elm simple form example
module Main exposing (..)
import Http
import Task
import Html.App as Html
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Form exposing (Form)
import Form.Validate as Validate exposing (..)
@Microtribute
Microtribute / ConstructorMapper.php
Created October 28, 2020 06:11 — forked from boekkooi/ConstructorMapper.php
Symfony Form DataMapper using object constructors
<?php
namespace Acme\Symfony\Form\DataMapper;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
class ConstructorMapper extends PropertyPathMapper
{
-- Extensible Records
-- given a record
x = { age = 42, name = "Boke" }
-- you can clone and remove a field in the process
{ x - age } -- { name = "Boke" }
-- you can also add a field
{ x | species = "Jade Dragon" } -- { age = 42, name = "Boke", species = "Jade Dragon" }