Skip to content

Instantly share code, notes, and snippets.

View MaraScott's full-sized avatar
🇪🇺
Maras IT

MaraScott MaraScott

🇪🇺
Maras IT
View GitHub Profile
@MaraScott
MaraScott / help.html
Created March 7, 2013 02:57
Name : help - Language : HTML - type : how to - platform : generic - tag :
<!--
Definition
OL : Order List
UL : Unorder List
LI : List Item
-->
<!-- Example -->
<ul>
<li>Text</li>
@MaraScott
MaraScott / add_image_size.php
Created March 7, 2013 03:01
Name : add_image_size() - Language : PHP - type : function - Platform : wordpress - tag : add_theme_support, post-thumbnails, set_post_thumbnail_size
<?php
// see : https://workflowy.com/#/7a7c77bb-b1f0-8b7a-1979-62ece0658eb8
// to put in functions.php
if ( function_exists( 'add_theme_support' ) ) {
// wp thumbnails (sizes handled in functions.php)
add_theme_support('post-thumbnails');
// default thumb size
set_post_thumbnail_size( 326, 100 ); // default Post Thumbnail dimensions
}
@MaraScott
MaraScott / add_rewrite_rules.php
Created March 7, 2013 07:05
Name : add_rewrite_rules() - Language : PHP - type : function - Platform : wordpress - tag : createRewriteRules, add_rewrite_tag, rewrite_rules, generate_rewrite_rules, query_vars
<?php
// see : http://www.prodeveloper.org/create-your-own-rewrite-rules-in-wordpress.html
/***************** REWRITE RULES *****************/
/*** create Generic rewrite rules ***/
function createRewriteRules() {
global $wp_rewrite;
// add rewrite tokens
$keytag = '%tag%';
@MaraScott
MaraScott / BadBot.htaccess
Last active December 14, 2015 21:09
Name : BadBot - Language : htaccess - type : rewriterule - platform : apache - tag : security, black list
# Added by HackRepair.com, for Bad Bot protection
# see : http://pastebin.com/5Hw9KZnW
# http://pastebin.com/raw.php?i=5Hw9KZnW
# update with : https://gist.github.com/davask/c96dfa24ef8d87f998c5
Options -Indexes
RewriteEngine on
#Block comment spammers, bad bots and some proxies
RewriteCond %{REMOTE_HOST} 12.226.240.248 [OR]
RewriteCond %{REMOTE_HOST} 24.111.102.26 [OR]
@MaraScott
MaraScott / php.ini
Last active December 14, 2015 22:29
Name : php - Language : ini - type : conf - platform : wordpress - tag : apc, WP Super Cache, Internal Zend error
# to fix the issue between APC and WP Super Cache
# unresolved yet
# see : https://bugs.php.net/bug.php?id=59298
# http://wordpress.org/support/topic/supercache-internal-zend-error-wtf?replies=5
# Set a php5.ini or php.ini in the folder defined by PHPRC
# see : http://www.ostraining.com/blog/coding/phpini-file/
# for shared server wait for the restart of it - see : http://support.godaddy.com/groups/web-hosting/forum/topic/restarting-apache-on-shared-server/
apc.filters = wp-cache-base
apc.include_once_override = 0
@MaraScott
MaraScott / environment_message.php
Last active December 15, 2015 02:09
Name : environment_message() - Language : PHP - type : message - Platform : generic - tag : jQuery, box, text, alert, IP, development, production, localhost
<?php
$env = array(
'url' => array(
'000.00.000.00'=>'ONLINE',
'127.0.0.1'=>'OFFLINE',
),
'type' => array(
'dev' => 'DEVELOPMENT',
'www' => 'PRODUCTION'
)
@MaraScott
MaraScott / getLastModification.php
Created March 20, 2013 03:51
Name : getLastModification() - Language : PHP - type : function - Platform : generic - tag : timestamp, version, images
<?php
// put a timestamp after images as a variable to be sure to update the cache on the client side
// see : http://php.net/manual/en/function.filemtime.php
function getLastModification ($filename = __FILE__) {
if (file_exists($filename)) {
return filemtime($filename);
} else {
return '404';
}
@MaraScott
MaraScott / getObectIndex.js
Last active December 16, 2015 20:39
Name : _getInfoOf() - Language : JavaScript - type : function - Platform : generic - tag : indexOf, object
// Extend an object to get the value of the first occurence of a specific index
var _getInfoOf = function (obj, index, path, isIndexExists) {
"use strict";
var prevPath = '';
if (typeof path !== 'undefined') {
prevPath = path + '.';
} // END IF
if (typeof isIndexExists === 'undefined') {
isIndexExists = [];
} // END IF
@MaraScott
MaraScott / language-list.js
Created June 28, 2013 05:10
Name : language-list - Language : JavaScript - type : object - Platform : generic - tag : country, language, flag
var language = {
AD: "ANDORRA"
AE: "UNITED ARAB EMIRATES"
AF: "AFGHANISTAN"
AG: "ANTIGUA AND BARBUDA"
AI: "ANGUILLA"
AL: "ALBANIA"
AM: "ARMENIA"
AN: "NETHERLANDS ANTILLES"
AO: "ANGOLA"
@MaraScott
MaraScott / generateAsciiList.js
Created August 27, 2014 07:22
Name : generateAsciiList() - Language : JavaScript - type : function - Platform : generic - tag : ascii, encode
for (var i=0; i<128; i++) {
document.writeln ((i%32?'':'<p>') + i + ': ' + String.fromCharCode (i) + '<br>');
}