Skip to content

Instantly share code, notes, and snippets.

View xavhan's full-sized avatar
💭
Hello

Xavier Haniquaut xavhan

💭
Hello
View GitHub Profile
@xavhan
xavhan / Shazam to youtube and spotify.js
Last active January 9, 2018 08:58
Shazam Crawler and Youtube Searcher in the console
var data = [];
$(".ti__details").each(function(i){
var artist = $(this).find(".ti__artist meta").attr("content");
var title = $(this).find(".ti__title").attr("content");
var format = artist + " - " + title;
var yt = 'http://www.youtube.com/results?search_type=&search_query=' + encodeURI(artist + " " + title) + '&aq=f&oq=';
var spoti = 'https://play.spotify.com/search/'+ encodeURI(artist + " " + title);
var item = new Object;
console.groupCollapsed(format);
console.log(yt);
@xavhan
xavhan / Grep JSCS inline report
Last active August 29, 2015 14:21
jscs counter
jscs ./ --config=.jscsrc | cut -d " " -f1 | uniq -c | sort [ | wc -l]
jscs ./ --config=.jscsrc #get jscs results
| cut -d " " -f1 #keep only the file path
| uniq -c #group by file path and count
| sort #sort asc
#################################
| wc #get the number of files to change
//count($0); for counting watchers on the selected dom element
//count($0, true); for counting watchers on the selected dom element + childrens
function count(el, recurs) {
var root = $(el);
var watchers = [];
var f = function (element) {
if (element.data().hasOwnProperty('$scope')) {
angular.forEach(element.data().$scope.$$watchers, function (watcher) {
watchers.push(watcher);
@xavhan
xavhan / ytmp3.zsh
Last active January 10, 2016 14:56
Alias for downloading youtube music and automatically tag it
# Nice alias for youtube-dl for downloading mp3 from youtube
# and other media services, parse the title and the thumbnail
# to add the adequate metadatas.
# You need to provide a youtube id.
# > ytmp3 venrUQLZ87M
# or
# > ytmp3 https://www.youtube.com/watch?v=venrUQLZ87M
# It works with playlists too !
#
@xavhan
xavhan / circlecistatus.js
Created November 19, 2015 16:08
Circle CI status + karma-coverage link
var REPO = 'githubUsername/repoName';
var TOKEN = 'token';
getCircleStatus(TOKEN, REPO);
function getCircleStatus() {
var endpoint = 'project/' + REPO;
httpGetAsync(endpoint, printStatus)
}

Financiers

Need

| Nom     | Qté       |      |     |     |     |
|---------|-----------|------|     |     |     |
| sucreGla| 60g       |  105 |  92 | 265 | 220 |culdepoule1
| pamande | 30g       |  53  |  41 | 118 | 98  |culdepoule1
| farine  | 20g       |  35  |  27 | 78  | 65  |culdepoule1
| beurre | 50g | 87 | 76 | 220 | 183 |casserole1
@xavhan
xavhan / machine.js
Last active May 27, 2020 14:23
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'report',
initial: 'idle',
context: {
answers: 0,
},
states: {
idle: {
on: {
CREATE_REPORT: 'filled'
@xavhan
xavhan / machine.js
Last active October 15, 2020 13:57
Generated by XState Viz: https://xstate.js.org/viz
const campaignStateMachine = Machine({
id: 'Campaign state',
initial: 'draft',
guards: {
beforeActivation: (c,e) => false,
inActivation: (c,e) => true,
afterDeactivation: (c,e) => false,
},
states: {
@xavhan
xavhan / machine.js
Last active October 15, 2020 14:40
Generated by XState Viz: https://xstate.js.org/viz
const sharedStates = {
initial: 'pending',
states: {
pending: {
on: {
ACTIVATE: 'active',
}
},
active: {
@xavhan
xavhan / machine.js
Last active October 15, 2020 15:21
Generated by XState Viz: https://xstate.js.org/viz
const sharedStates = {
initial: 'pending',
states: {
pending: {
on: {
'': {
target: 'active',
cond: 'isActivated'
},
}