Skip to content

Instantly share code, notes, and snippets.

View zaigham's full-sized avatar
🌏

Zaigham R. zaigham

🌏
View GitHub Profile
@pepebe
pepebe / getTVLabel.snippet.php
Last active September 9, 2015 08:26
Proof of concept for toggling tv groups with a select TV in MODX.
<?php
/*
getTVLabel snippet for modx 2.3
Version:
------------------
v0.0.1 (2015-03-06 16:44)
Author:
------------------
@rashkur
rashkur / chrome_icon_fixer
Created September 7, 2014 19:59
chrome icon fixer
import ConfigParser, mmap
config_file = "/usr/share/applications/google-chrome.desktop"
add_string_to_each_section = ["StartupWMClass", "Google-chrome-stable"]
option = add_string_to_each_section[0]
value = add_string_to_each_section[1]
class Fixer:
def check(self, cf, option, value):
@ck-on
ck-on / hhvminfo.php
Last active September 18, 2022 05:44
HHVMinfo - phpinfo for HHVM HipHop Virtual Machine
<?php
/*
HHVMinfo - phpinfo page for HHVM HipHop Virtual Machine
Author: _ck_
License: WTFPL, free for any kind of use or modification, I am not responsible for anything, please share your improvements
Version: 0.0.6
* revision history
0.0.6 2014-08-02 display fix for empty vs zero
0.0.5 2014-07-31 try to determine config file from process command line (may not always work), style improvements
@webinfinita
webinfinita / bootstrap-breakpoints.sass
Last active March 2, 2025 20:24
Variables for responsive design in bootstrap with sass
@mixin breakpoint($point)
@if $point == lg
@media (min-width: 1200px)
@content
@else if $point == md
@media (min-width: 992px) and (max-width: 1199px)
@content
@else if $point == sm
@frisospeulman
frisospeulman / seoProKeywordConvertor
Last active September 6, 2022 07:36
Converts keyword tv to seoPro Keywords objectCreate a snippet and run it on a blank page.
<?php
/**
* Convert your keyword tv to Sterc's SeoPro
*
* Please read the following.
* Everytime you run this snippet, your keywords within seoPro will be overwritten.
* Make sure the TV exists before runnig this code.
*
*/
$seoPro = $modx->getService('seopro', 'seoPro', $modx->getOption('seopro.core_path', null, $modx->getOption('core_path') . 'components/seopro/') . 'model/seopro/', $scriptProperties);
@Avidid
Avidid / domain_extract.php
Created July 30, 2013 16:48
Extract domain from email address using regex
<?php
$regex = '/@((([^.]+)\.)+)([a-zA-Z]{3,}|[a-zA-Z.]{5,})/';
preg_match($regex, '[email protected]', $matches);
print_r($matches);
preg_match($regex, '[email protected]', $matches);
print_r($matches);
@jmervine
jmervine / 01_nginx.conf
Last active November 27, 2021 16:04
Nginx Based A/B testing.
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /home/t/nginx/conf/mime.types;
default_type application/octet-stream;
@pepebe
pepebe / debug2chunk
Created July 23, 2013 10:32
Write formit values into a debug chunk
<?php
/*
* Write formit values into a debug chunk
* basic idea by bruno17
* Be careful with the append parameter. If your script continues to
* write into the debug chunk, You'll get a GIGANTIC file that
* can cause a wsod (white screen of death) without any hint to the real cause...
*/
$append = false;
@mkschell
mkschell / babelContextRouter.plugin.php
Last active October 19, 2023 07:08
MODX Cloud web rules example for Babel with two languages.In this example, German is the default language with resources in the 'web' context; English is the secondary language, set up in the 'en' context.This technique is based on the "SEO Friendly Multilingual Websites" article archived here: https://web.archive.org/web/20180927220103/http://w…
<?php
if($modx->context->get('key') != "mgr"){
/* grab the current langauge from the cultureKey request var */
switch ($_REQUEST['cultureKey']) {
case 'en':
/* switch the context */
$modx->switchContext('en');
break;
default:
/* Set the default context here */
@opengeek
opengeek / optimized.html
Created September 18, 2012 17:08
Example of optimizing conditional filters using a Chunk wrapper
[[[[*page-image:notempty=`$wrapImgThumb? &src=`*page-image` &alt=`[[*pagetitle]]` &thumbOpts=`w=480&h=320``]]]]