Skip to content

Instantly share code, notes, and snippets.



Block or report user

Report or block bertrandg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bertrandg / wave.js
Created May 18, 2017 — forked from also/wave.js
Generate WAVE file headers in JavaScript
View wave.js
function buildWaveHeader(opts) {
var numFrames = opts.numFrames;
var numChannels = opts.numChannels || 2;
var sampleRate = opts.sampleRate || 44100;
var bytesPerSample = opts.bytesPerSample || 2;
var blockAlign = numChannels * bytesPerSample;
var byteRate = sampleRate * blockAlign;
var dataSize = numFrames * blockAlign;
bertrandg / ngrx-effects-advance-example.js
Last active Nov 27, 2019
ngrx/effects advance example
View ngrx-effects-advance-example.js
// Nothing changed here, works as previously.
@Effect() actionX$ = this.updates$
.switchMap(payload => this.api.callApiX(payload)
.map(data => ({type: 'ACTION_X_SUCCESS', payload: data}))
.catch(err => Observable.of({type: 'ACTION_X_FAIL', payload: err}))
bertrandg / ngrx-effects-simple-example.js
Last active Feb 14, 2017
ngrx/effects simple example
View ngrx-effects-simple-example.js
@Effect() actionX$ = this.updates$
.switchMap(payload => this.api.callApiX(payload)
.map(data => ({type: 'ACTION_X_SUCCESS', payload: data}))
.catch(err => Observable.of({type: 'ACTION_X_FAIL', payload: err}))
@Effect() actionY$ = this.updates$
bertrandg /
Created Jun 11, 2016 — forked from btroncone/
A Comprehensive Introduction to @ngrx/store - Companion to Series

#Comprehensive Introduction to @ngrx/store By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

View 1. Example.scss
@include keyframe(fadeout) {
0% {
opacity: 1;
100% {
opacity: 0;

console.log wrap resolving for your wrapped console logs

I've heard this before:

What I really get frustrated by is that I cannot wrap console.* and preserve line numbers

We enabled this in Chrome DevTools via blackboxing a bit ago.

If you blackbox the script file the contains the console log wrapper, the script location shown in the console will be corrected to the original source file and line number. Click, and the full source is looking longingly into your eyes.

View 1.How to easily implement a REST API with oAuth2

It's still a work in progress...


As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

View fb_tab_app_4.0.x.php
// required Facebook PHP SDK v4.0.9 or later.
// include required files form Facebook SDK
require_once( 'Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'Facebook/HttpClients/FacebookCurl.php' );
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'Facebook/Entities/AccessToken.php' );
require_once( 'Facebook/Entities/SignedRequest.php' );
View find_duplicate_id.js
var all_ids = [];
var duplicate_ids = [];
$('[id]').each(function(index){ all_ids.push( $(this).attr('id') ) })
all_ids = all_ids.sort();
for (var i = 0; i < all_ids.length - 1; i++) {
if (all_ids[i + 1] == all_ids[i]) duplicate_ids.push(all_ids[i]);
console.log('duplicate id: ', duplicate_ids);
You can’t perform that action at this time.