Skip to content

Instantly share code, notes, and snippets.

View Manoz's full-sized avatar
😏
Meh

Kévin Legrand Manoz

😏
Meh
View GitHub Profile
<?php
/* Remove an old shortcode.
* Code by @boiteaweb
*/
/*
* Exemple:
* [button color="babyblue" link="http://manoz.fr/facebook-template/2012-Facebook-template.zip" target="_blank"]Télécharger le template[/button]
*/
add_shortcode( 'button', 'sc_button' );
$("pre code:contains($)").html(function(_, html) {
return html.replace(/\$+/ig, '<span class="red">$</span>');
});
$(document).click(function(event) {
if ($('.popup-content').is(":visible")) {
$('.popup-content').fadeOut('slow', function() {})
}
});
$('#popup').click(function(event) {
if ($('.popup-content').is(":visible")) {
$('.popup-content').fadeOut('slow', function() {})
} else {
@Manoz
Manoz / style.css
Created May 4, 2014 23:13
Simple spinner icon
.spinner-icon {
width: 14px;
height: 14px;
border: solid 2px transparent;
border-top-color: #5bcad3;
border-left-color: #5bcad3;
border-radius: 10px;
-webkit-animation: spinner-anim 400ms linear infinite;
-moz-animation: spinner-anim 400ms linear infinite;
-o-animation: spinner-anim 400ms linear infinite;
@Manoz
Manoz / admin-1.php
Created May 30, 2014 17:13
Tuto géoloc pour mon blog.
<body>
<div class="content">
<h1>Administration, lol</h1>
<div class='main'>
<?php
$server = 'localhost'; // Server de votre bdd
$username = 'tutogeoloc'; // Nom d'utilisateur
$password = 'password'; // Mot de passe
$database = 'tuto-geoloc'; // Nom de la bdd
@Manoz
Manoz / functions.php
Last active August 29, 2015 14:04
Hack the default WordPress video player if you want a width different than the $content_width global.
/**
* This function is the same as str_replace but once
* A small warning: this has not been tested in RSS feeds.
* Thx @ScreenFeedFr for the hack
* @link https://twitter.com/ScreenFeedFr/status/492056927745343489
* @param string $search Value being searched for.
* @param string $replace Replacement value
* @param string $subject String being searched and replaced
* @param boolean $rev I don't fucking know what this var do :)
* @return string Replaced value
@Manoz
Manoz / mixins.scss
Created September 21, 2014 14:58
SASS Animation mixin
// Keyframe animations
// # Use: `@include animation('ANIM_NAME DURATION ITERATION_COUNT');`
@mixin keyframes($animation-name) {
@-webkit-keyframes $animation-name {
@content;
}
@-moz-keyframes $animation-name {
@content;
}
@Manoz
Manoz / gist:f6c65f7b20430424639f
Created October 24, 2014 22:39
WordPress: check if the comment author is the post author.
<?php
/**
* By default, WordPress add a .bypostauthor class on comments
* I prefer echo something to have a better control in CSS.
* Exemple: http://codepen.io/Creaticode/full/ijExL
*/
global $post;
if ( $comment->user_id === $post->post_author ) {
echo '<span class="is-author">Author</span>';
@Manoz
Manoz / Preferences.sublime-settings
Created March 25, 2015 22:15
Preferences.sublime-settings
{
"bold_folder_labels": true,
"color_scheme": "Packages/Monokai Extended/Monokai Extended.tmTheme",
"default_line_ending": "unix",
"drag_text": false,
"draw_minimap_border": true,
"enable_tab_scrolling": true,
"fade_fold_buttons": true,
"font_face": "Source Code Pro",
"font_size": 11,
@Manoz
Manoz / optimize.bat
Created August 26, 2015 10:14
Recursive Image Optimisation (Windows)
:: Uses 'jpegtran.exe' and 'pngout.exe'. Go Google them.
@echo none
for /d /r %%a in (*) do (
pushd "%%a"
echo processing "%%a"
md "OptimizedJPEGS"
for %%i in (*.jpg) do "C:\imageoptimization\jpegtran.exe" -optimize -progressive -copy none "%%i" "OptimizedJPEGS\%%i"
move /Y "OptimizedJPEGS\*.*" .
rd "OptimizedJPEGS"
for %%i in (*.png) do "C:\imageoptimization\pngout.exe" "%%i"