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 / dropzone.js
Last active December 17, 2015 20:09
Dropzone.js quick configuration
Dropzone.options.mydropzone = {
//url: null,
//method: "post"
parallelUploads: 2,
maxFilesize: 0.31, // MB
//paramName: "file", // The name that will be used to transfer the file
//createImageThumbnails: true,
//maxThumbnailFilesize: 10,
thumbnailWidth: 100,
thumbnailHeight: 100,
@Kaapiii
Kaapiii / connect
Created May 30, 2013 14:47
Connect MySQL Workbench to xampp
// MySQL config file
C:\xampp\mysql\bin (my.ini)
//
bind-address=0.0.0.0
@Kaapiii
Kaapiii / googlemaps-bootstrap.js
Created May 31, 2013 15:25
Clean Solution for Google maps v3 and bootstrap issues
// Triggering a tab a second time, the map doesn't render properly
// This lines solves the rendering problem
google.maps.event.addListener(map, 'bounds_changed', function() {
google.maps.event.trigger(map, 'resize');
});
// If a map is located in a tab "tab-bane" class
// the map UI is messed up, to solve it, add the lines below
// map-canvas is the element where you load in the map
.map-canvas img{
@Kaapiii
Kaapiii / langnavbar.php
Last active December 19, 2015 08:49
Beta langNavBar Beta
<?php
/**
* getFrontendLangNavigation()
* @param \Cx\Core\Routing\Url $pageUrl
* @param boolean $langNameContraction
* @return string
*/
function getFrontendLangNavigation($page, $pageUrl, $langNameContraction = false)
{
$activeLanguages = \FWLanguage::getActiveFrontendLanguages();
@Kaapiii
Kaapiii / gist:7267504
Created November 1, 2013 15:56
array_intersection_key with on array with nested array
<?php
// Starting Point
/*array(2){
// intersection array 1
array(3) {
[2]=>
array(5) {
["id"]=>
string(1) "2"
@Kaapiii
Kaapiii / index.php
Created December 2, 2013 11:59
JSON output with PHP + Angular
<?php
// Exammple function to output
funnction getFeed(){
$data = array();
$json = json_encode($data);
// Set the content-type - to avoid mime-type conversions
header('content-type: application/json; charset=utf-8');
// Set Origin to allow access by javascript,
// if no access-controll-allow-origin header is set
// an Error is raised
@Kaapiii
Kaapiii / .htaccess
Created December 4, 2013 09:42
Restrict folder access on Apache by file type
# Restrict folder access (according to permission settings)
# Deny all exept the listed file tpyes
<Files ^(*.jpeg|*.jpg|*.png|*.gif)>
order deny,allow
deny from all
</Files>
# Allow all all listed files
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|mp3|mpg|mp4|mov|wav|wmv|png|gif|swf|css|js)$">
Allow from All
@Kaapiii
Kaapiii / install-lamp-on-ubuntu
Last active January 1, 2016 12:49
Ubuntu install uptodate Lamp
// install python
// so-> sudo add-apt-repository ppa:ondrej/php5 gets regcognized
sudo apt-get install python-software-properties
// shut down server droplet
sudo shutdown -h now
// ------------------------------------------
// install newest php and apache version from
// ------------------------------------------
@Kaapiii
Kaapiii / hosts
Created February 14, 2014 10:01
Create V-Hosts on XAMPP
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# Location: C:\Windows\System32\drivers\etc\hosts
#
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
// Basic Example of using Google Geocoding API
var lat;
var lng;
function getLocationFromAdress(address){
var geoCoder = new google.maps.Geocoder();
var address = "Unterdorfstrasse 2, 3612 Steffisburg"
geoCoder.geocode({ 'address': address }, function(results, status){