Skip to content

Instantly share code, notes, and snippets.

Philippe Lhoste PhiLhoSoft

View GitHub Profile
@PhiLhoSoft
PhiLhoSoft / index.ts
Last active Feb 14, 2019
RxJS error management exploration
View index.ts
// 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 Sep 14, 2018
Generator of groups of participants for first turn of a tournament
View Tournoi.css
body
{
display: flex;
flex-direction: column;
}
#ParticipantList
{
max-width: 500px;
}
@PhiLhoSoft
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
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
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
Using https://atom.io/packages/sync-settings
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
PhiLhoSoft / ReadMe.md
Created Nov 9, 2015
Add validation to WP-Members (WordPress plugin) registration form
View ReadMe.md

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.

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,-1
^
|
+
0,0 0.5,0 1,0
+----------+
@PhiLhoSoft
PhiLhoSoft / ReadMe.md
Created Jun 23, 2015
Improving Most.js' Drag'n'Drop example
View ReadMe.md
You can’t perform that action at this time.