Skip to content

Instantly share code, notes, and snippets.

View marcmascort's full-sized avatar
☠️
Searching the One Piece

Marc Mascort Bou marcmascort

☠️
Searching the One Piece
View GitHub Profile
@marcmascort
marcmascort / style.css
Created March 21, 2015 13:30
Import Twenty twelve style
@import url("../twentytwelve/style.css");
@marcmascort
marcmascort / style.css
Created March 21, 2015 13:27
Twenty twelve child theme style header
/*
Theme Name: Twenty Twelve Fill
Theme URI: http://exemple.com/
Description: Tema fill per el tema Twenty Twelve
Author: El teu nom
Author URI: http://exemple.com/about/
Template: twentytwelve
Version: 0.1
*/
@marcmascort
marcmascort / wp_disable_core_automatic_updates.php
Created March 21, 2015 11:40
WP disable core automatic updates
define('WP_AUTO_UPDATE_CORE', false);
@marcmascort
marcmascort / wp_disable_all_automatic_updates.php
Last active August 29, 2015 14:17
WP disable all automatic updates
define('AUTOMATIC_UPDATER_DISABLED', false);
@marcmascort
marcmascort / GDEditor.php
Created November 19, 2014 10:52
Force GD image editor for Wordpress (Solve HTML ERROR uploading images)
<?php
function change_graphic_lib($array) {
return array( 'WP_Image_Editor_GD', );
}
add_filter( 'wp_image_editors', 'change_graphic_lib' );
@marcmascort
marcmascort / divide_array_by_golden_ratio.php
Created September 6, 2014 00:33
Divide array by golden ratio
<?php
function divide_array_by_golden_ratio($arr)
{
$ab = count($arr);
if ($ab < 2)
{
return false;
}
$phi = (1 + sqrt(5)) / 2;
$a = round($ab / $phi);
@marcmascort
marcmascort / get_fibonacci_sequence.php
Created September 6, 2014 00:23
Get the Fibonacci sequence
<?php
function fibonacci_sequence($limit=0)
{
$limit = abs(intval($limit));
$sequence = array();
$count = 0;
while($count < $limit)
{
$a = isset($sequence[$count-2]) ? $sequence[$count-2] : 0;
$b = isset($sequence[$count-1]) ? $sequence[$count-1] : 1;
@marcmascort
marcmascort / get_fibonacci_sequence_up_to_a_maximum_value.php
Last active August 29, 2015 14:06
Get the Fibonacci sequence up to a maximum value
<?php
function fibonacci_sequence_up_to($value=0)
{
$value = abs(intval($value));
$sequence = array();
$count = 0;
while($count===0 || $sequence[$count-1] < $value)
{
$a = isset($sequence[$count-2]) ? $sequence[$count-2] : 0;
$b = isset($sequence[$count-1]) ? $sequence[$count-1] : 1;
@marcmascort
marcmascort / get_fibonacci_N_number.php
Last active August 29, 2015 14:06
Get the Fibonacci N number
<?php
function fibonacci($n=0)
{
$n = abs(intval($n));
return ($n===0) ? 0 : ( ($n === 1 || $n === 2) ? 1 : ( fibonacci($n - 1) + fibonacci($n - 2) ) );
}
?>