Skip to content

Instantly share code, notes, and snippets.

View PhiLhoSoft's full-sized avatar

Philippe Lhoste PhiLhoSoft

View GitHub Profile
@PhiLhoSoft
PhiLhoSoft / TOSA-MDF-2018-12-1 - Intérêts débiteurs.js
Last active October 17, 2019 14:12
Meilleur dev de France 2018 (Tosa) midi
/*******
* 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
PhiLhoSoft / index.ts
Last active February 14, 2019 15:04
RxJS error management exploration
// index.ts as typed in https://stackblitz.com/edit/rxjs-iqjrzu
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
PhiLhoSoft / Tournoi.css
Created September 14, 2018 09:06
Generator of groups of participants for first turn of a tournament
body
{
display: flex;
flex-direction: column;
}
#ParticipantList
{
max-width: 500px;
}
@PhiLhoSoft
PhiLhoSoft / TypeScriptDecorators.ts
Last active May 14, 2018 11:57
TypeScript decorators in examples a bit less trivial than found so far...
// 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
PhiLhoSoft / RxCustomObservable.js
Last active May 31, 2016 13:59
RxJS Custom Observable
// 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
PhiLhoSoft / Example.csv
Last active October 30, 2023 00:06
Parse CSV file with Node.js
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
Using https://atom.io/packages/sync-settings
'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
PhiLhoSoft / ReadMe.md
Created November 9, 2015 23:40
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: http://entraides-citoyennes.org/ 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.

/* 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,-1
^
|
+
0,0 0.5,0 1,0
+----------+