Skip to content

Instantly share code, notes, and snippets.

@ulybu
ulybu / weekByMonthMap
Created September 30, 2022 07:29
Creates a map that groups weeks of the year by month, like `[0: [1,2,3,4], 1:[5,6,7,8], 2: [9,10,11,12,13],,]`
export const getWeekNumbersForYear = year => {
const date = dayjs(`${year}-01-01`)
const numberOfWeek = date.isoWeeksInYear()
const arrayOfWeekWithFirstDay = []
for (let week = 1; week <= numberOfWeek; week += 1) {
const day = dayjs().year(year).isoWeek(week).day(1)
arrayOfWeekWithFirstDay.push({
@ulybu
ulybu / SpotifyIDsToText.js
Last active March 3, 2017 11:43
export spotify ids to text
function extractSpotify (data) {
var tracks = data.tracks;
var extract = tracks.map( track => ({
artist: track.artists[0].name,
title : track.name,
}));
return extract;
}
function formatSpotify (extracted) {
var out = extracted
@ulybu
ulybu / Readme.md
Last active January 23, 2017 14:18
Export googleMusic playlist

#Export a google music playlist

Why

Export to a text list and use anpother tool (like http://www.playlist-converter.net/#/) to import it to another app (like deezer, spotify.. )

How

Currently export to a simple list format, because that's enough to be supported by http://www.playlist-converter.net/#/.

This script will generate from your playlist page a text like this

@ulybu
ulybu / exportDeezerPlaylist.js
Last active March 21, 2021 09:04
export a deezer plylist to csv
function json2csv(data, header) {
if(header) {
data.unshift(header);
}
return data.map(function(e) {
for(var i=0; i<e.length; i++) {
if(~e[i].indexOf(',')) {
e[i] = '"' + e[i] + '"';
}
}
@ulybu
ulybu / DuolinguoSpeech README.md
Last active December 7, 2015 13:21
Duolinguo speech shortcut

What is it

This bookmarklet will add a key shortcut to lauch the speech on duolinguo.com This way you can keep your hand on the keyboard without having to lick on the speaker button to hear the pronunciation By default it set ctrl as the keyboard but you're free to set the key you want (see install procedure)

Bookmarklet ?

Bookmarklets are tiny programs stored inside bookmarks. Similar to add-ons, extensions, and user scripts, they add new tools to your web browser. Bookmarklets are shared on web pages as web links. You don't actually "install" a bookmarklet. You simply add it to your bookmarks. It just sits there patiently until you want to use it.

@ulybu
ulybu / Ledjam auto-login
Last active August 29, 2015 14:16
Auto-login for Ledjamradio.com
function showLoginPopup(){
mMain.showPopup('popup_login');
}
function login(){
mMain.login();
}
function getInput(which){
var selector,
input;
switch(which){

This variation of a donut chart demonstrates how to update values with an animated transition. Clicking on the radio buttons changes the displayed metric.

Next: Missing Data
Previous: Static Update