Skip to content

Instantly share code, notes, and snippets.


Philippe Lhoste PhiLhoSoft

View GitHub Profile
PhiLhoSoft / TOSA-MDF-2018-12-1 - Intérêts débiteurs.js
Last active Oct 17, 2019
Meilleur dev de France 2018 (Tosa) midi
View TOSA-MDF-2018-12-1 - Intérêts débiteurs.js
* Read input from STDIN
* Use: console.log() to output your result.
* Use: console.error() to output debug information into STDERR
* ***/
var input = [];
// readline_object.on("line", (value) => { //Read input values
// input.push(value);
PhiLhoSoft / index.ts
Last active Feb 14, 2019
RxJS error management exploration
View index.ts
// index.ts as typed in
import { of, throwError } from 'rxjs';
import { map, switchMap, catchError, tap, finalize } from 'rxjs/operators';
const source = of('World').pipe(
map(x => { return { good: `Hello ${x}!` }; }),
// Comment out for testing regular behavior
switchMap((x) => throwError('bad')),
PhiLhoSoft / Tournoi.css
Created Sep 14, 2018
Generator of groups of participants for first turn of a tournament
View Tournoi.css
display: flex;
flex-direction: column;
max-width: 500px;
PhiLhoSoft / TypeScriptDecorators.ts
Last active May 14, 2018
TypeScript decorators in examples a bit less trivial than found so far...
View TypeScriptDecorators.ts
// TypeScript decorators.
// Shows how decorators compose, how to pass parameters.
// For classes, shows how to enrich a class and alter the constructor.
// You can just paste this gist in the TS playground...
//import "reflect-metadata"; // Cause error in playground
// tslint:disable no-console // These are for demo purpose
// tslint:disable member-access // Simpler
PhiLhoSoft / RxCustomObservable.js
Last active May 31, 2016
RxJS Custom Observable
View RxCustomObservable.js
// Make a RxJS custom observable, using the pattern seen in rx.angular.js and RxJS-DOM.
// This is a skeleton, with meaningless code at the core, it is only to show the pattern.
/* global define */// Appeases ESLint
/* eslint no-invalid-this: 0 */
// UMD (global & AMD & Common.js) loader
(function __iife(root, factory)
// The AMD way
PhiLhoSoft / Example.csv
Last active Feb 23, 2016
Parse CSV file with Node.js
View Example.csv
Area Type Town name number value region sub-region
Unknown Area Type Hlegu 1511.19895194 Yangon Yangon, (North)
Unknown Area Type Cocokyun 33.8113207395 Yangon Yangon, (South)
Unknown Area Type Mese 1818.94431751 Kayah Bawlake
View index.txt
View atom-perforce.js
'use strict';
var atomPerforce = module, // sugary alias
path = require('path'),
os = require('os'),
p4 = require('node-perforce'),
Q = require('q'),
$ = require('jquery'),
environment = require('./environment'),
clientStatusBarElement = $('<div/>')
PhiLhoSoft /
Created Nov 9, 2015
Add validation to WP-Members (WordPress plugin) registration form

Add validation to WP-Members (WordPress plugin) registration form

I maintain a small French WordPress site: It was made by design students which made a great work with looks, but a so-so technical work... So I had to fix the issues.

They used a iFeature 5 theme by CyberChimps, they made a .css file in a child theme. I had to make CSS fixes to get labels of the registration form (made with the WP-Members plugins) to be aligned with the input fields...

WP-Members is a nice plugin, rather flexible as it allows to add custom fields to registration.

View anchor.js
/* Anchor array: [ x, y, dx, dy ]
x, y (close of square): position on node, 0.0 to 1.0
dx, dy (end of arrows): direction, -1, 0 or 1
0,0 0.5,0 1,0