Skip to content

Instantly share code, notes, and snippets.

View zourite's full-sized avatar
🤓
Working on Shifumi Game #JS/HTML/CSS

Sonia SAUGRIN zourite

🤓
Working on Shifumi Game #JS/HTML/CSS
View GitHub Profile
@zourite
zourite / function.php
Last active August 29, 2015 13:57
Wordpress - This function return an array of related posts by tag if the article number is not enough, it's completed with articles of same category.
<?php
/* WordPress Related Post */
function related_article($number) {
$tags[] = get_the_tags();
foreach($tags as $tag) :
@zourite
zourite / functions.php
Last active August 29, 2015 14:02
Get Instagram and Twitter Post via API
<?php
function buildBaseString( $baseURI, $method, $params ) {
$r = array();
ksort( $params );
foreach ( $params as $key=>$value ) {
$r[] = "$key=" . rawurlencode( $value );
}
return $method."&" . rawurlencode( $baseURI ) . '&' . rawurlencode( implode( '&', $r ) );
@zourite
zourite / Slider
Last active August 29, 2015 14:13
Un simple slider qui permet de faire défiler des éléments
jQuery(document).ready(function () {
$(".slide").not(".current").hide();
setInterval(function() {
$(".current").nextAll(".slide").first().slideDown("slow").addClass("current");
$(".current").prevAll().removeClass("current");
$(".slide").not(".current").hide();
@zourite
zourite / functions.php
Created June 24, 2015 10:42
Fil d'ariane pour #Wordpress
<?php function the_breadcrumb() {
global  $wp_query;
$name = single_cat_title ( '' '', false);
$category_id = get_cat_ID( $name );
$category = get_the_category();
$category_link = get_category_link( $category_id );
//Categorie Parents
$object = $wp_query->get_queried_object();
@zourite
zourite / meta-head.php
Created November 20, 2015 12:29
Meta Media Sociaux - WordPress
<?php
$img_src = get_stylesheet_directory_uri() . '/img/default_image.jpg';
$title = "Sonia SAUGRIN - Freelance Web";
$description = "Les technologies sont pour moi une façon d'aider les gens, ils donnent un pouvoir à ceux qui les utilisent. Le pouvoir de partager, de liaison, de parler avec la terre entière.";
$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if(is_single()) :
if(has_post_thumbnail($post->ID)) :
@zourite
zourite / listofcommand.sh
Last active December 3, 2015 04:58
Backup data to Dropbox
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
($HOME/.dropbox-dist/dropboxd &)& #Lancer Dropbox en arrière plan
# Editer le fichier cron crontab -e
30 02 * * * mysqldump -u user -ppassword --all-databases | gzip > ~/Dropbox/site.sql.gz
00 02 * * * tar -zcf ~/Dropbox/site-content.tgz /var/www/prod/blog/wp-content
@zourite
zourite / nginx.conf
Last active February 19, 2018 13:05
NGINX - SSL
#SSL Config
# to generate your dhparam.pem file, run in the terminal
# openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_session_cache shared:SSL:1m;
@zourite
zourite / reunion_districts.json
Created March 12, 2018 21:33 — forked from michelt/reunion_districts.json
Villes, quartiers et codes postaux de la Réunion
[
{
"name": "Les Avirons",
"postcode" : "97425",
"city" : "Les Avirons"
},
{
"name": "Bagatelle",
"postcode" : "97441",
"city" : "Sainte-Suzanne"
@zourite
zourite / docker.yml
Created March 20, 2019 05:07
Docker files pour WordPress
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
<?php
/**
* PHPMailer simple contact form example.
* If you want to accept and send uploads in your form, look at the send_file_upload example.
*/
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require 'vendor/autoload.php';
if (array_key_exists('to', $_POST)) {
$err = false;