Skip to content

Instantly share code, notes, and snippets.

View HendrikHaase's full-sized avatar
🏠
Working from home

Hendrik HendrikHaase

🏠
Working from home
View GitHub Profile
@HendrikHaase
HendrikHaase / zip.php
Created May 4, 2015 12:28
zip contents of a webspace without ssh access.
<?php
// die maximale Ausführzeit erhöhen
ini_set("max_execution_time", 300);
// Objekt erstellen und schauen, ob der Server zippen kann
$zip = new ZipArchive();
if ($zip->open("backup_".date("Y-m-d")."_".substr(md5(date("h-i-s")),0,8).".zip", ZIPARCHIVE::CREATE) !== TRUE) {
die ("Could not open archive");
}
@HendrikHaase
HendrikHaase / rex_tpl_rootCategoriesToArray.php
Last active August 29, 2015 14:17
Redaxo - gets all root categories and puts them in an array.
<?php
$root = array();
foreach (OOCategory::getRootCategories(true, $this->getValue("clang")) as $cat) {
array_push($root, $cat->getName());
}
?>
@HendrikHaase
HendrikHaase / style.css
Created March 10, 2015 08:44
dynamische CSS Selektoren
li[class^="name-von-klasse-zb"] {
blubb: bla;
}
@HendrikHaase
HendrikHaase / rex_tpl_tabbed.php
Created March 5, 2015 13:33
redaxo template for displaying a tabbed-template without any "navigation" at all, all content will be loaded upon creation. the template will load all subcategories of the rootcategory "tabs" and display those as links @ nav.
<html>
<head>
<!-- META inf -->
<!-- mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- remote JS -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
app.post('/api/query', function (req, res) {
if (req.body.query) {
async.waterfall([
function (next) {
var query=req.body.query;
console.log(query);
connection.query(query, next);
},
function (rows, fields, next) {
app.post('/api/resolve', function(req, res) {
console.log("req.body: ", req.body);
if(req.body.field && req.body.val && req.body.out && req.body.table) {
connection.query("SELECT "+req.body.out+" FROM "+req.body.table+" WHERE "+req.body.field+" LIKE "+req.body.val+" LIMIT 0,1");
} else {
res.send(666, "Internal Server Error");
}
});
function ajaxreturnafterfunctionreturn(navObject) {
var foo = [];
var j = 0;
var jsonconfig = getConfig(navObject);
$.ajax({
type: 'POST',
url: '/api/select',
data: JSON.stringify({
function getConfig(navObject) {
//final element we'll return, holds the whole json
var $jsondata;
_.each(sCategories, function(z, rootName) {
var desiredCategory = false;
var desiredSubCategory = false;
if(rootName != navObject.bcm) {
//check here
function createBreadcrumbs(navObject) {
//local var used for counting
var i = 0;
//final element we'll return, holds the whole breadcrumbs which get added to the navbar-nav
var $ol = $(document.createElement('ol'));
$ol.addClass('breadcrumb').addClass('default-b');
var $dropdown = $(document.createElement('li')); //holds the dropdown used to display the functions like search, add, etc inside the main category
$dropdown.addClass('dropdown'); //there is max. 1 dropdown created this way, so... (
function createModal(bcm, bcs) {
var $modal = $(document.createElement('div')).attr('id', 'modal');
$modal.addClass('modal').addClass('fade').addClass('in');
$modal.attr('tabindex','-1').attr('role','dialog').attr('aria-labelledby','label').attr('aria-hidden','false');
$modal.attr('style','display; block;');
var $modalDialog = $(document.createElement('div'));
$modalDialog.addClass('modal-dialog');
var $modalContent = $(document.createElement('div'));