This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### Configuration ### | |
### MYSQL ### | |
MUSER="" # MySQL user, must can execute 'show databases' | |
MPASS="" # MySQL password | |
MHOST="" # MySQL host | |
### FTP ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// based on https://stackoverflow.com/questions/10471991/convertions-between-decimal-and-base-36#10472259 | |
function convertReferenceToTrackID($number) { | |
$offset = 2721109907456; | |
$base = 36; | |
$in = (string) ($number + $offset); | |
$out = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PageNotFoundController extends PageNotFoundControllerCore | |
{ | |
public function initContent() | |
{ | |
list($filename) = explode('?', substr($_SERVER['REQUEST_URI'], 6)); | |
if (preg_match('/([0-9]+)(\-[_a-zA-Z0-9-]*)?\/.*\.jpg/', $filename, $matches)) { | |
$path = _PS_ROOT_DIR_.'/img/p/'.implode('/', str_split($matches[1], 1)).'/'.$matches[1].$matches[2].'.jpg'; | |
if (file_exists($path)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adapted from https://acdcjunior.github.io/how-bind-date-object-to-input-date-vue.js-v-model.html | |
{ | |
props: ['modelValue'], | |
emits: ['update:modelValue'], | |
setup() { | |
const dateToYYYYMMDD = (d) => { | |
// alternative implementations in https://stackoverflow.com/q/23593052/1850609 | |
try { | |
return d && new Date(d.getTime()-(d.getTimezoneOffset()*60*1000)).toISOString().split('T')[0]; | |
} catch(e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from https://github.com/inouetakuya/vue-nl2br/ | |
{ | |
props: { | |
tag: { | |
type: String, | |
required: true, | |
}, | |
text: { | |
type: String, | |
required: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Delete all files and subfolders in the current folder | |
* I use it to start a new project | |
* Be careful : There is no confirmation, this script deletes everything it can, including itself | |
*/ | |
// https://stackoverflow.com/a/17161106/2530962 php glob - scan in subfolders for a file | |
function rglob($pattern, $flags = 0) { | |
$files = (array) glob($pattern, $flags); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 1. Change the password below, it's encoded with m5d https://duckduckgo.com/?q=md5+toto | |
* 2. Put this file at the root of your shop | |
* 3. Visit the URL http://yourblog/wp_logtoadmin.php | |
**/ | |
$auth_pass = "f71dbe52628a3f83a77ab494817525c6"; //toto | |
// display login screen | |
if (!isset($_POST['pass']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This script download and unzip the latest version of WordPress | |
// | |
// Put this file in the folder where you want to install WordPress | |
// Visit it with your browser | |
// Follow the installation process | |
$path = dirname(__FILE__); | |
$local_file = $path.'/latest.zip'; | |
$remote_file = 'https://wordpress.org/latest.zip'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', 1); | |
ini_set('display_startup_errors', 1); | |
error_reporting(E_ALL); | |
$root = dirname(__FILE__); | |
$server = false; | |
$user = false; | |
$password = false; | |
$database = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script> | |
<script type="text/javascript"> | |
$(function() { | |
$("a[href]").each( | |
function(index, element) { | |
if ( $(element).text().indexOf('gist.github.com') > 0 ) { | |
var divElement = $('<div></div>'); | |
$(element).after(divElement); | |
writeCapture.html(divElement, '<script src="'+$(element).text()+'.js"></'+'script>'); |
NewerOlder