Skip to content

Instantly share code, notes, and snippets.

View geoffroycochard's full-sized avatar

Geoffroy Cochard geoffroycochard

  • Orléans - France
View GitHub Profile
<?php
/**
* Created by PhpStorm.
* User: geoffroycochard
* Date: 22/01/2020
* Time: 16:49
*/
// src/Security/TokenAuthenticator.php
namespace App\Security;
@geoffroycochard
geoffroycochard / router.php
Created December 6, 2018 21:13
Router php -S for WP Pretty links
<?php
// Extracted from the `wp-cli` project. https://wp-cli.org/
$root = $_SERVER['DOCUMENT_ROOT'];
$path = '/'. ltrim( parse_url( urldecode( $_SERVER['REQUEST_URI'] ) )['path'], '/' );
if ( file_exists( $root.$path ) ) {
// Enforces trailing slash, keeping links tidy in the admin
if ( is_dir( $root.$path ) && substr( $path, -1 ) !== '/' ) {
<?php
namespace App\Data;
class Todo
{
private $todos = [
1 => [
'title' => 'todo1',
@geoffroycochard
geoffroycochard / generateListFromMap.js
Last active May 18, 2018 09:41
Generate list Artifica Widget load
/**
* Generate Liste from artifica.Widget
* @param widget
* @param container
*/
function generateListFromMap(widget, container) {
var onMarkersReady = new Promise(function (resolve, reject) {
var checkIfPropertyIsEvaluated = function () {
if (widget.markers.length !== 0) {
resolve(widget);
@geoffroycochard
geoffroycochard / artifica_api_put.md
Last active June 28, 2017 14:18
Artifica API : PUT

Bash

#!/bin/bash
# Using httpie: https://github.com/jakubroztocil/httpie
# test PUT dans category 881145
http --verbose --form PUT https://ice.artifica.fr/api/json/map/element key=XXXXXXXXXXXXXX parent=881145 title=point1 table=marker

Request

@geoffroycochard
geoffroycochard / Spider.js
Created June 13, 2017 09:08
Spider effect custo
// No spider effect until zoom 18
if (this.map.zoom < 18) {
return;
}
// Group markers by position
var groups = _.groupBy(this.map.markers, function (marker) {
return marker.latitude + ';' + marker.longitude;
});
@geoffroycochard
geoffroycochard / account.service.ts
Created October 13, 2016 22:38
OroPlatform API WSSE Header generation client Side in Angular2
import { Injectable } from '@angular/core';
import { Http, Response, Headers } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import { Account } from '../model/account-model';
import hashes = require('crypto-js');
import moment = require('moment');
@Injectable()
@geoffroycochard
geoffroycochard / layout.html.twig
Created November 19, 2015 13:40
lp_sf2 / Layout BootStrap starter template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>{% block title %}Demo App!{% endblock %}</title>