Skip to content

Instantly share code, notes, and snippets.

View MaxLazar's full-sized avatar
😇

Max Lazar MaxLazar

😇
View GitHub Profile
@MaxLazar
MaxLazar / .htaccess
Created August 23, 2012 17:47
ExpressionEngine .htaccess template
# Standard .htaccess file
# Secure .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Don't show any directory without an index file
Options -Indexes
{
"font_face": "Consolas",
"font_size": 12,
"highlight_line": true,
"highlight_modified_tabs": true,
"hot_exit": false,
"ignored_packages":
[
"Vintage"
],
@MaxLazar
MaxLazar / .gitignore ee
Last active December 20, 2015 01:59
.gitignore file for ExpressionEngine 2
# Global Files
config.local.php
.sass-cache
.DS_Store
[Tt]humbs.db
!.gitignore
*.log
# Images
images/cache/*
@MaxLazar
MaxLazar / gist:6968523
Last active December 25, 2015 11:19
Duplicate Transcribe languages variables
public function dublicate () {
$language_id_to_clone = ($this->EE->input->get_post("source_lang")) ? $this->EE->input->get_post("source_lang") : 1;
$site_id_to_clone = ($this->EE->input->get_post("source_site")) ? $this->EE->input->get_post("source_site") : 1;
$target_lang = ($this->EE->input->get_post("target_lang")) ? $this->EE->input->get_post("target_lang") : 4;
$target_site = ($this->EE->input->get_post("target_site")) ? $this->EE->input->get_post("target_site") : 5;
//english copy to english
//admin.php?S=1736f35e8929d2a29031274d6d2b0d87&D=cp&C=addons_modules&M=show_module_cp&module=transcribe&method=dublicate&source_lang=1&source_site=1&target_lang=1&target_site=5
@MaxLazar
MaxLazar / gist:7281376
Last active December 27, 2015 06:28
Cleanup ExpressionEngine spammers from DB
#Delete all pending ExpressionEngine members mysql query
DELETE FROM exp_member_data where member_id in (select member_id FROM exp_members where group_id = 4) LIMIT 1000000
DELETE FROM exp_message_folders where member_id in (select member_id FROM exp_members where group_id = 4) LIMIT 1000000
DELETE FROM exp_member_homepage where member_id in (select member_id FROM exp_members where group_id = 4) LIMIT 1000000
DELETE FROM exp_members where group_id = 4 LIMIT 1000000
#remove all users who have links in bio (be carefully with this!)
DELETE FROM exp_member_data where member_id in (select member_id FROM exp_members where bio REGEXP 'http') LIMIT 1000000
DELETE FROM exp_message_folders where member_id in (select member_id FROM exp_members where bio REGEXP 'http') LIMIT 1000000
DELETE FROM exp_member_homepage where member_id in (select member_id FROM exp_members where bio REGEXP 'http') LIMIT 1000000
private function _prep_no_results() {
$td =& ee()->TMPL->tagdata;
$open = 'if mx_no_results';
$close = '/if';
if ( strpos( $td, $open ) !== FALSE && preg_match( '#'.LD.$open.RD.'(.*?)'.LD.$close.RD.'#s', $td, $match ) ) {
if ( stristr( $match[1], LD.'if' ) ) {
$match[0] = ee()->functions->full_tag( $match[0], $td, LD.'if', LD.'\/if'.RD );
}
// ==UserScript==
// @name Relative Require Test
// @namespace test
// @include http*
// @require san.user.js
// ==/UserScript==
alert('a');
@MaxLazar
MaxLazar / gist:bac36db4b834c7ccd5ac
Created October 10, 2014 05:24
replace underscore to dash with Nginx
#http://stackoverflow.com/a/15934256/2183354
location ~ _ {
rewrite ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5-$6-$7-$8-$9;
rewrite ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5;
rewrite ^([^_]*)_([^_]*)_(.*)$ $1-$2-$3;
rewrite ^([^_]*)_(.*)$ $1-$2;
rewrite ^ $uri permanent;
}
@MaxLazar
MaxLazar / gist:713563dcb395cf499303
Created October 10, 2014 11:41
Disable double-tap “zoom” option in browser on touch devices
#http://stackoverflow.com/questions/10614481/disable-double-tap-zoom-option-in-browser-on-touch-devices
(function($) {
$.fn.nodoubletapzoom = function() {
$(this).bind('touchstart', function preventZoom(e) {
var t2 = e.timeStamp
, t1 = $(this).data('lastTouch') || t2
, dt = t2 - t1
, fingers = e.originalEvent.touches.length;
$(this).data('lastTouch', t2);
@MaxLazar
MaxLazar / UUID.php
Last active August 29, 2015 14:12 — forked from dahnielson/UUID.php
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.