Skip to content

Instantly share code, notes, and snippets.

View xavhan's full-sized avatar
💭
Hello

Xavier Haniquaut xavhan

💭
Hello
View GitHub Profile
//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 / 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
@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);