Skip to content

Instantly share code, notes, and snippets.

View Kaapiii's full-sized avatar

Markus Liechti Kaapiii

  • Payrexx AG
  • Switzerland
View GitHub Profile
@Kaapiii
Kaapiii / setFileAndFolderPermissions
Created November 27, 2012 16:23
Alter file and folder permissions of Apaches default user -> www-data
<?php
function setFilePermissions($dir) {
if ($handle = opendir($dir)) {
while ($file = readdir($handle)) {
if ($file != '.' && $file != '..' && __FILE__ != $dir.'/'.$file) {
if (is_dir($dir.'/'.$file)) {
chmod($dir.'/'.$file, 0755);
setFilePermissions($dir.'/'.$file);
} else {
chmod($dir.'/'.$file, 0644);
@Kaapiii
Kaapiii / new Contrexx3 placeholders
Last active December 12, 2015 03:28
Contrexx3 New Placehoders
//-------------------------
// New Contrexx3 placeholders
//-------------------------
/*
for use in html files use --> {PLACEHOLDER_NAME}
for use in Contrexx3 editor please use -> [[PLACEHOLDER_NAME]]
*/
@Kaapiii
Kaapiii / module_newsletter_profile.html
Last active December 12, 2015 04:18
Contrexx3 Newsletter Module Files
<div id="newsletter">
<!-- BEGIN newsletter_error_message -->
<div class="errorMessage">
[[NEWSLETTER_ERROR_MESSAGE]]</div>
<!-- END newsletter_error_message --><!-- BEGIN newsletter_ok_message -->
<div class="okMessage">
[[NEWSLETTER_OK_MESSAGE]]</div>
<!-- END newsletter_ok_message --><!-- BEGIN newsletterForm -->
<div class="form">
<form action="[[NODE_NEWSLETTER_PROFILE]]" method="post" name="newsletter">
@Kaapiii
Kaapiii / .htaccess redirect o www
Created February 16, 2013 22:15
Redirecting non-www to www and vice versa
# Redirecting non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# Redirecting www to non-www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^my-domain\.com$ [NC]
RewriteRule ^(.*)$ http://my-domain.com/$1 [R=301,L]
@Kaapiii
Kaapiii / cookie.js
Created April 15, 2013 13:32
Store and retrieve cookie values
@Kaapiii
Kaapiii / .htaccess
Last active December 16, 2015 11:09
Enable bowser caching with htaccess
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
# Images
ExpiresByType image/gif "access plus 6 months"
ExpiresByType image/jpeg "access plus 6 months"
ExpiresByType image/png "access plus 6 months"
ExpiresByType image/x-icon "access 1 year"
# Media
ExpiresByType application/x-shockwave-flash "access 1 month"
@Kaapiii
Kaapiii / .htaccess
Last active December 16, 2015 16:08
.htaccss performance boost
#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
#End Gzip
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
# Images
@Kaapiii
Kaapiii / typeahead.js
Last active December 16, 2015 16:49
Typeahead.js how to use filters
$("#search").typeahead({
remote: 'url',
limit: 10,
prefetch: {
url:hotelPrefetchURL,
filter:function(respData){
var data = respData.data;
return data;
},
ttl: 86400000
@Kaapiii
Kaapiii / determineBrowser.js
Created April 26, 2013 13:11
Javascript navigator
if( navigator.userAgent.match(/iPhone/i) ) this.webkit_css_enabled = true;
else if( navigator.userAgent.match(/iPod/i) ) this.webkit_css_enabled = true;
else if( navigator.userAgent.match(/iPad/i) ) this.webkit_css_enabled = true;
else if( navigator.userAgent.match(/Chrome/i) ) this.webkit_css_enabled = true;
else if( navigator.userAgent.match(/Safari/i) ) this.webkit_css_enabled = true;
// check for certain platforms
if( navigator.userAgent.match(/Android/i) ) this.is_android = true;
if( navigator.userAgent.match(/Android 2.1/i) ) this.is_android21 = true;
if( navigator.userAgent.match(/Android 2.2/i) ) this.is_android22 = true;
@Kaapiii
Kaapiii / netbeans.conf
Created May 28, 2013 06:22
Increase Netbeans Memory netbeans directory -> etc/netbeans.conf
netbeans directory -> etc/netbeans.conf
-J-XX:MaxPermSize=2048