Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lukasbestle's full-sized avatar

Lukas Bestle lukasbestle

View GitHub Profile
@lukasbestle
lukasbestle / kirbytag.php
Last active January 6, 2016 20:25
Dynamic image Kirbytag
<?php
// Please note: Use http://getkirby.com/docs/cheatsheet/helpers/kirbytag for tags that don't require access to the files of the page
$field = new Field($page, null, '(image: example.jpg)');
echo $field->kirbytext();
@lukasbestle
lukasbestle / search.php
Created November 5, 2015 12:29
Kirby $pages->search() that searches for full matches only
<?php
/**
* Fork of the native $pages->search() method
* Only searches for full matches
*/
function search($collection, $query, $params = array()) {
if(is_string($params)) {
$params = array('fields' => str::split($params, '|'));
@lukasbestle
lukasbestle / fizzbuzz.php
Created August 31, 2014 10:29
Fizz Buzz Test in PHP
<?php
for($i = 1; $i <= 100; $i++) {
$found = false;
// Divisible by 3
if($i % 3 == 0) {
echo 'Fizz';
$found = true;
}
@lukasbestle
lukasbestle / keybase.md
Created August 27, 2014 15:02
keybase.md

Keybase proof

I hereby claim:

  • I am lukasbestle on github.
  • I am lukasbestle (https://keybase.io/lukasbestle) on keybase.
  • I have a public key whose fingerprint is 3A6F 39F5 BB6A A8D7 EF8D 0DC7 2B97 B9B6 1C7E A7B7

To claim this, I am signing this object:

@lukasbestle
lukasbestle / kirbytext.extended.php
Created June 30, 2014 14:44
Kirbytag for HTML5 video (Kirby 1)
<?php
class kirbytextExtended extends kirbytext {
function __construct($text, $markdown=true) {
parent::__construct($text, $markdown);
$this->addTags('video');
// define custom attributes
$this->addAttributes('poster');
@lukasbestle
lukasbestle / update.sh
Last active August 29, 2015 14:02
Shell script to update every Git repository in direct subdirectories of the script directory
#!/usr/bin/env bash
# Updates every Git repository in direct subdirectories of the script directory
# Usage: ./update
# Copyright: Lukas Bestle <lukas@lu-x.me>, 2014
# Check if git is installed
hash git &> /dev/null || {
echo -e "\033[31mYou don't have git installed.\033[0m"
exit 1
@lukasbestle
lukasbestle / install_kirby2.sh
Created January 3, 2014 10:57
A simple shell script to install Kirby CMS v2 from GitHub and init a new Git repo for your site
# Get the default theme and switch to the folder
git clone https://github.com/getkirby-themes/default kirbyproject
cd kirbyproject
# Re-create the Git repo (this is a new site)
rm -Rf .git
git init
# Get the Kirby core as submodule
rmdir kirby
@lukasbestle
lukasbestle / smoothscroll.js
Created September 6, 2013 12:28
Vanilla JS smooth scrolling
/**
* Vanilla JS smooth scrolling
*
* @version 0.1b1
* @author Lukas Bestle <lukas@lu-x.me>
* @copyright Lukas Bestle
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
// Configuration
// Check iOS Version and change the META
window.onload = function() {
var iOSVersion;
if (/iP(hone|od|ad)/.test(navigator.platform)) {
// supports iOS 2.0 and later
var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
iOSVersion = [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
iOSVersion = parseInt(iOSVersion[0]);
}
@lukasbestle
lukasbestle / howto.sh
Last active December 16, 2015 18:29
Spendenbytrag mass donator
curl https://gist.githubusercontent.com/lukasbestle/5477654/raw/9dd750f33d4dbb917308b998b3775f1c7125c76a/spendenbytrag.sh | bash