Skip to content

Instantly share code, notes, and snippets.

View Yago's full-sized avatar
👨‍💻

Yann Gouffon Yago

👨‍💻
View GitHub Profile
@Yago
Yago / test.json
Created May 10, 2017 07:20
vscode config
hello
@Yago
Yago / cloudSettings
Last active May 10, 2017 07:22
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-05-10T07:21:12.905Z","extensionVersion":"v2.7.0"}
const trigger = new Rx.Subject();
const action = trigger.subscribe(() => {
console.log('Fire 🚀 !')
});
// Somewhere else
trigger.next();
const stream = Rx.Observable.from([2, 4, 6, 8, 10, 12]);
stream
.map(x => x * 2)
.filter(x => x % 3 === 0)
.skip(1)
.subscribe(
(x) => { console.log(x); },
(err) => { console.error(err); },
() => { console.log('Cypher ?'); }
const stream = Rx.Observable.from([1, 2, 3]);
stream.subscribe(
(x) => { console.log(x); },
(err) => { console.error(err); },
() => { console.log('Done 👍'); }
);
const listStream = Rx.Observable.from([1, 2, 3]);
const timeStream = Rx.Observable.interval(1000); // 1000ms
const promiseStream = Rx.Observable.fromPromise(fetch('ip.jsontest.com'));
const mergedStreams = Rx.Observable.merge(listStream, timeStream);
const emptyStream = Rx.Observable.empty();
@Yago
Yago / changelog.sh
Created March 13, 2017 13:04
Dynamically update Changelog.md base on commits since last tag.
#!/bin/bash
LASTDATE=$(git show -s --format=%ad `git rev-list --tags --max-count=1`)
echo $1 > VERSION
touch CHANGELOG.tmp
echo `date +"*$1* (%Y-%m-%d)"` >> CHANGELOG.tmp
COMMITS=`git log --pretty=format:" - %s (%h);" --since="$LASTDATE"`
index=0
IFS=';'
for line in $COMMITS; do
read -r -p "$line [y/N] " response
@Yago
Yago / format.js
Created June 16, 2016 06:27
Classic website - JavaScript usage
import $ from 'jquery';
const format = () => {
$('.btn').each((i, e) => {
const that = $(e);
that.addClass('btn-danger');
});
};
export default format;
@Yago
Yago / photoswipe-structure.html
Created November 11, 2015 10:00
PhotoSwipe - structure
<div id="gallery" class="gallery" itemscope itemtype="http://schema.org/ImageGallery">
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<a href="https://unsplash.it/1200/900/?image=695" data-caption="Sunset in the wheat field<br><em class='text-muted'>© Jordan McQueen</em>" data-width="1200" data-height="900" itemprop="contentUrl">
<img src="https://unsplash.it/400/300/?image=695" itemprop="thumbnail" alt="Image description">
</a>
</figure>
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<a href="https://unsplash.it/1200/900/?image=675" data-caption="Mysterious ocean<br><em class='text-muted'>© Barn Images</em>" data-width="1200" data-height="900" itemprop="contentUrl">
<img src="https://unsplash.it/400/300/?image=675" itemprop="thumbnail" alt="Image description">
</a>
@Yago
Yago / photoswipe-click.js
Created November 11, 2015 09:57
PhotoSwipe - Click
$('a').click(function(event){
event.preventDefault();
var $pswp = $('.pswp')[0],
options = {
index: $(this).parent('figure').index(),
bgOpacity: 0.85,
showHideOpacity: true
};