Skip to content

Instantly share code, notes, and snippets.

View starckio's full-sized avatar
🍼
Baby boy !

Christopher Dupré-Allanche starckio

🍼
Baby boy !
View GitHub Profile
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
<?php
// get the post UID from the URL
$uid = param('post');
if(!$uid) die(a::json(array(
'status' => 'error',
'msg' => 'The post could not be found',
)));
<?php
$blogs = $pages->findByUID('blog1', 'blog2');
$articles = $blogs->children()->sortBy('date', 'desc');
// if you want you can add a limit or pagination to that set of articles
// afterwards just use a regular foreach loop to go through them all.
?>
(function($) {
$.fn.smoothScroll = function() {
return this.on('click', function() {
var hash = $(this).attr('href');
var dest = $(hash).offset();
$('html:not(:animated),body:not(:animated)').animate({scrollTop: dest.top, scrollLeft: dest.left}, 500, function() {
window.location.hash = hash;
<ul>
<?php foreach($pages->visible() as $section): ?>
<li><a href="#<?php echo $section->uid() ?>"><?php echo html($section->title()) ?></a></li>
<?php endforeach ?>
</ul>
<?php $article = $pages->find('blog')->children()->last() ?>
<div class="footer">
<div class="container">
<div class="grid full">
// Displays the latest blog article
<h3><?php echo html($article->title()) ?></h3>
<small><?php echo html($article->Published()) ?></small>
<p><?php echo excerpt($article->text(), 250) ?>... <a href="<?php echo html($article->url()) ?>">Continue reading</a></p>
</div>
<div class="cf"></div>
<?php $n=0; foreach($page->children()->visible()->flip() as $article): $n++; ?>
<?php if($n==1): ?>
<!-- html for your first article -->
<?php else: ?>
<!-- html for all the other articles -->
<?php endif ?>
<?php endforeach ?>
@bastianallgeier
bastianallgeier / routes.php
Last active July 27, 2017 19:04
Sample route setup for Kirby 2
<?php
c::set('routes', array(
array(
'pattern' => 'projects/old-project-url-for-project-a',
'action' => function() {
go('projects/project-a');
}
),
array(
@bastianallgeier
bastianallgeier / statify.php
Last active October 4, 2022 17:12
A first draft for a script, which converts a Kirby site into a static site. It's a rough first draft, so don't expect it to be perfect. Play with it, if you like it!
<?php
/**
* Instructions:
*
* 1. Put this into the document root of your Kirby site
* 2. Make sure to setup the base url for your site correctly
* 3. Run this script with `php statify.php` or open it in your browser
* 4. Upload all files and folders from static to your server
* 5. Test your site
@bastianallgeier
bastianallgeier / controllers--contact.php
Created October 1, 2014 19:36
Plain contactform example for Kirby 2
<?php
return function($site, $pages, $page) {
$alert = null;
if(get('submit')) {
$data = array(
'name' => get('name'),