Skip to content

Instantly share code, notes, and snippets.

View niklausgerber's full-sized avatar
🍪

Niklaus Gerber niklausgerber

🍪
View GitHub Profile
@niklausgerber
niklausgerber / gist:1620782
Created January 16, 2012 13:07
Problem with Variables
I would like to change this
$LOGIN_INFORMATION = array(
'username' => 'password'
);
into this
$LOGIN_INFORMATION = array(
$page->username() => $page->password()
@niklausgerber
niklausgerber / gist:1647196
Created January 20, 2012 12:39
Protect kirby pages
# The Snippet
<?php
// getting the username and password
$LOGIN_INFORMATION = array(
(string)$page->benutzernamen() => $page->passwort()
// 'user' => 'password',
);
Let's say I have 30 items then the scrubber will move off screen. How can I manage that out of the amount of object it is calculated how far the scrubber moves - the more items the shorter is the distance the scrubber moves every time? This means the scrubber starts always at left end ends at right - how many items I would have.
/*
###### ###### ### ## ########
## ## ## ## ## ## ## ##
## ## ## ## ## ##
###### ## ## ## ## ######
## ## ######### ## ##
## ## ## ## ## ## ## ##
###### ###### ## ## ######## ########
Short URL: http://scalecss.com
Title: Your Title
----
Background: #ececec
----
Background-Banner: #ffffff
@niklausgerber
niklausgerber / home.php
Created February 28, 2012 09:42
Show articles on home but not on blog page / different folder
<?php foreach($page->children()->visible()->flip() as $article): ?>
<li>
<a href="<?php echo $article->url() ?>"><?php echo html($article->title()) ?> <span><?php echo html($article->published()) ?></span></a>
</li>
<?php endforeach ?>
<?php if($page->hasPrev()): ?>
« <a href="<?php echo $page->prev()->url() ?>">Previous</a>
<?php endif ?>
| //Separator: Should only show up between "Previous | Next" but not if there is just one.
<?php if($page->hasNext()): ?>
<a href="<?php echo $page->next()->url() ?>">Next</a> »
<?php endif ?>
<img src="<?php $image = $article->images()->find('thumb.gif') ?><?php echo $image->url() ?>"> //that works
<img src="<?php $image = $article->images()->find('thumb.gif') ?><?php echo thumb($img, array('width' => 200), false); ?>"> //and this does not
@niklausgerber
niklausgerber / idea.txt
Created March 19, 2012 14:51
KirbyTXT SPAN, CLASSES and ID
In KirbyText I can do this:
##Text
and it will give me
<h2>Text</h2>
I can also do this (link: http://getkirby.com text: getkirby popup: yes) which will give me a link. Brilliant would be if I could generate span classes or even direct classes or IDs out of this. As an Idea:
@niklausgerber
niklausgerber / hack.sh
Created April 3, 2012 07:34 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#