Skip to content

Instantly share code, notes, and snippets.

View ben-barbier's full-sized avatar
💫
¯\_(ツ)_/¯

Benjamin Barbier ben-barbier

💫
¯\_(ツ)_/¯
View GitHub Profile
@ben-barbier
ben-barbier / pokemon.json
Last active August 29, 2015 14:08 — forked from shri/pokemon.json
{
"1":{
"name":"Bulbasaur",
"attack":49,
"defense":49,
"evolveLevel":16,
"evolveTo":"2",
"type":"grass",
"moves":[
"tackle",
@ben-barbier
ben-barbier / app.js
Last active August 29, 2015 14:26
AngularJS - Loading page with progress bar
(function() {
'use strict';
angular.module('myApp', []);
angular
.module('myApp')
.config(myAppConfig);
myAppConfig.$inject = ['$httpProvider'];
@ben-barbier
ben-barbier / ThreadTestCompletableFuture.java
Last active May 29, 2016 22:09
CompletableFuture example (like javascript promises)
public class ThreadTest {
public static void main(String[] args) throws InterruptedException, ExecutionException {
List<String> refs = new ArrayList<String>();
refs.add("AA907");
refs.add("H0704");
refs.add("FD123");
refs.add("DV067");
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://monsite.preprod.fr', 'http://www.prod.fr') WHERE option_value LIKE '%http://monsite.preprod.fr%';
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://monsite.preprod.fr', 'http://www.prod.fr') WHERE post_content LIKE '%http://monsite.preprod.fr%';
UPDATE wp_posts SET guid = REPLACE(guid, 'http://monsite.preprod.fr', 'http://www.prod.fr') WHERE guid LIKE '%http://monsite.preprod.fr%';
@ben-barbier
ben-barbier / gulpfile.js
Last active March 1, 2017 08:05
Gulp config...
(function () {
'use strict';
/**
Online documentation : https://github.com/gulpjs/gulp/blob/master/docs/API.md
Main tasks :
* gulp serve :
serve application on http://localhost:9000
export class AuthenticationService {
loginState: Subject<any> = new Subject();
constructor(private http: Http) {
}
logout() {
this.http.get('http://logout...')
.subscribe(() => {
@ben-barbier
ben-barbier / rx-error.ts
Last active April 14, 2017 13:46
rx - how to chain calls ?
import {Component} from '@angular/core';
import {Team} from '../../../models/team';
import {Sprint} from '../../../models/sprint';
import {Observable} from 'rxjs/Observable';
import {Http, Response} from '@angular/http';
@Component({
selector: 'app-test-backlog-agile',
templateUrl: './test-backlog-agile.component.html',
styleUrls: ['./test-backlog-agile.component.scss']
@ben-barbier
ben-barbier / retry-sub-observable.ts
Last active December 17, 2020 00:52
⚡️RxJS 🚀, mergemap with retry and fallback
public launchCachePreloading() {
this.nomenclatureService.getUniverses().pipe(
flatMap(e => e),
mergeMap(universe => this.nomenclatureService.getFamilies(universe.id).pipe(
flatMap(e => e),
map(family => ({universeId: universe.id, familyId: family.id})),
)),
toArray(),
mergeMap(families => interval(1000).pipe(
filter(() => this.router.url === '/'),