Skip to content

Instantly share code, notes, and snippets.

View laurence001's full-sized avatar

Laurence Dierickx laurence001

View GitHub Profile
@laurence001
laurence001 / wpquery-sql-list-of-posts
Last active October 22, 2021 06:53
MySQL Query - Wordpress: generate list of posts (date, title, URL, character count)
SELECT `ID`, `post_date`, `post_type`,`post_title`, `post_status`, `guid`, SUM( LENGTH(`post_content`)) AS 'Wordcount' FROM `wp_posts` GROUP BY `ID` HAVING `post_type` = 'post' AND `post_status` = 'publish' ORDER BY `Wordcount` DESC LIMIT 0, 10000
@laurence001
laurence001 / kid_a.R
Created May 14, 2021 06:16 — forked from charlie86/kid_a.R
Kid A album art
# devtools::install_github('charlie86/spotifyr')
library(jpeg)
library(grid)
library(ggplot2)
library(spotifyr)
library(ggthemes)
library(tidyverse)
kid_a <- get_artist_audio_features('radiohead') %>%
filter(album_name == 'Kid A') %>%
#install.packages("tydiverse")
library(tidyverse) #Pour la manipulation des données (collection de packages)
#install.packages("dslabs")
library(dslabs)
data(gapminder)
head(gapminder)
#Filtres
@laurence001
laurence001 / R
Created November 20, 2020 11:48
R Basics
library(tidyverse)
library(dplyr)
rename(tableau, Quantité = vecteur)
rename(tableau, Vitesse = superv)
filter(commune, Cas > 45)
arrange(commune,Province)
select(commune,Cas)
rename(commune, Ville = Commune)
@laurence001
laurence001 / R
Last active November 28, 2019 20:00
Sentiment analysis
library("dplyr")
library("tidyverse")
library("tidytext")
library("ggplot2")
words <- titresFR %>% unnest_tokens('word','Titre')
rm(stopb)
stopb <- c("les","très","bien","on","cet","d'","le","et","la","de","pour","l'","lorsque","du","par","en","un","des","pas","dans","ils","plus","à","sont","est")
library("tidyverse")
library("dplyr")
library(ggplot2)
tableau <- as.data.frame(evolution)
print(tableau)
ggplot(data=tableau, aes(x=annee, y=print))+
geom_bar(stat="identity", fill="coral")
@laurence001
laurence001 / greentheme.R
Last active October 14, 2019 12:06
Theme for Highcharter package (R)
greentheme <- hc_theme (
colors = c('#019875', '#52a654', '#92ae29', '#b5ae0d', '#d9ac00', '#ffa600'), #array of colors
chart = list(
backgroundColor = '#FFFFFF'
),
loading = list (
hideDuration = 1000,
showDuration = 1000
),
title = list(
@laurence001
laurence001 / loader.html
Created May 14, 2019 06:05
Loader (html/css/jQuery)
<!-- Dans le HTML -->
<div class="page_loader">
<div id="inner">
<img src="chemindugifanime.gif" alt="loader" />
</div>
</div>
<!--Trouver un loader gif ?
Ici, par exemple : https://loading.io/
-->
@laurence001
laurence001 / levenshtein.js
Last active May 12, 2019 15:34
Levenshtein Distance
function distance(a, b) {
var n = a.length, m = b.length, matrice = [];
for(var i=-1; i < n; i++) {
matrice[i]=[];
matrice[i][-1]=i+1;
}
for(var j=-1; j < m; j++) {
matrice[-1][j]=j+1;
}
for(var i=0; i < n; i++) {
@laurence001
laurence001 / bubble.html
Created April 30, 2019 06:41
Bubble chart D3js
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>Bubble chart avec D3js</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">