Skip to content

Instantly share code, notes, and snippets.

@jeremyb
jeremyb / meetups.js
Last active April 19, 2018 13:02
Upcoming Meetup.com events of Montpellier with node.js and tcomb
const fetch = require('node-fetch');
const t = require('tcomb');
const meetupApiKey = process.env.MEETUP_API_KEY;
if (meetupApiKey === undefined) {
throw new Error('Must provide MEETUP_API_KEY env variable');
}
const Group = t.struct({
id: t.Number,
@jeremyb
jeremyb / groups.json
Created November 10, 2017 16:38
Groupes meetups tech à Montpellier
{
"name": "MUG Montpellier",
"status": "active",
"city": "Montpellier",
"link": "https://www.meetup.com/MUG-Montpellier/",
"members": 204
}
{
"name": "AFUP Montpellier",
"status": "active",
<?php
namespace Infrastructure\Composer;
use Composer\Installer\InstallationManager;
use Composer\Package\CompletePackage;
use Composer\Repository\InstalledFilesystemRepository;
use Composer\Script\Event;
use Composer\Util\Filesystem as ComposerFilesystem;
use Symfony\Component\Filesystem\Filesystem;
@jeremyb
jeremyb / swagger-validation.php
Created December 18, 2016 13:39
JSON data validation with Swagger definitions (through justinrainbow/json-schema)
<?php
// composer require justinrainbow/json-schema
require __DIR__.'/vendor/autoload.php';
$jsonSchema = json_decode(
file_get_contents('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/json/petstore-simple.json')
);
@jeremyb
jeremyb / 1. UserRepository.php
Created June 23, 2015 17:08
Repository interface example
<?php
namespace AppBundle\Model;
interface UserRepository
{
public function add(User $user);
public function remove(User $user);
@jeremyb
jeremyb / 1. UsernameType.php
Last active November 28, 2015 20:16
Username value object mapped to a form
<?php
namespace AppBundle\Form;
use AppBundle\Model\Username;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormError;
@jeremyb
jeremyb / documents.yaml
Last active October 5, 2020 15:54 — forked from anonymous/documents.yaml
Hierarchical facets with Elasticsearch
_type: product
category_level0: Books
category_level1: Computers & Technology
category_level2: Network Programming
name: Pro AngularJS
---
_type: product
category_level0: Books
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
// TinyMCE via jQuery plugin:
$('#wysiwyg').tinymce(globalConfigs.wysiwyg);
var globalConfigs = {
// ...
wysiwyg: {
script_url: '/js/tiny_mce/tiny_mce.js',
theme: "advanced",
element_format : "xhtml",
cleanup : true,
theme_advanced_buttons1: "<?php echo sfConfig::get('app_tinymce_theme_advanced_buttons1') ?>",
theme_advanced_buttons2: "<?php echo sfConfig::get('app_tinymce_theme_advanced_buttons2') ?>",