Skip to content

Instantly share code, notes, and snippets.

View andreasnymark's full-sized avatar

Andreas Nymark andreasnymark

View GitHub Profile
@andreasnymark
andreasnymark / gulpfile.js
Last active April 30, 2019 08:44
gulpfile.js
const { src, dest, task, series, watch } = require( 'gulp' );
const plumber = require( 'gulp-plumber' );
const prefix = require( 'gulp-autoprefixer' );
const concat = require( 'gulp-concat' );
const uglify = require( 'gulp-uglify' );
const header = require( 'gulp-header' );
const rename = require( 'gulp-rename' );
const media = require( 'gulp-group-css-media-queries' );
const nano = require( 'gulp-cssnano' );
const less = require( 'gulp-less' );
@andreasnymark
andreasnymark / config.php
Last active July 5, 2018 15:27
Kirby file upload
/**
* File upload
*
*
**/
array(
'pattern' => 'ajax/fileupload',
'method' => 'POST',
'action' => function () {
$site = site();
@andreasnymark
andreasnymark / GetKirby : Filter post by language
Last active August 29, 2015 14:11
GetKirby : Filter post by language
// All posts, filter by language
$posts = $page->children()
->visible()
->flip()
->filter( function( $child ) {
$site = site();
$inv = $child->inventory();
if ( array_key_exists( $site->language->code(), $inv[ 'content' ] )) {
return $child;
}

Keybase proof

I hereby claim:

  • I am andreasnymark on github.
  • I am nymark (https://keybase.io/nymark) on keybase.
  • I have a public key whose fingerprint is 8E30 366D 7BF3 AECE 0882 FC3A 69E2 2B6E 4021 0CD6

To claim this, I am signing this object:

@andreasnymark
andreasnymark / gist:c4773831f32ed19a18d1
Created October 2, 2014 07:07
gulpfile.js for KSS
var gulp = require( 'gulp' ),
less = require( 'gulp-less' ),
prefix = require( 'gulp-autoprefixer' ),
minify = require( 'gulp-minify-css' ),
base64 = require( 'gulp-base64' ),
media = require( 'gulp-combine-media-queries' ),
size = require( 'gulp-size' ),
kss = require( 'gulp-kss' );
var modal=function(){"use strict";var e={button:".Button",close:".Close",all:"",event:"click",module:".FormModal",attrState:"data-state",stateExpanded:"is-expanded",stateCollapsed:"is-collapsed"},t=function(t){var t=t||window.event;t.preventDefault?t.preventDefault():t.returnValue=!1;var n=t.target||t.srcElement,r=n.parentNode||n.parentElement,i=r.getAttribute(e.attrState),s=n.previousSibling||n.nextSibling;i===e.stateExpanded?r.setAttribute(e.attrState,e.stateCollapsed):r.setAttribute(e.attrState,e.stateExpanded);s.className=s.className},n=function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent("on"+t,n)},r=function(){var t=document.querySelectorAll(e.button),r=document.querySelectorAll(e.close);if(t.length>0)for(var i=0;i<t.length;i++){var s=t[i];s.parentNode.setAttribute(e.attrState,e.stateCollapsed);n(s,e.event,modal.toggle)}if(r.length>0)for(var i=0;i<r.length;i++){var o=r[i];n(o,e.event,function(){var t=document.querySelectorAll(e.module);for(var n=0;n<t.length;n++)t[n].setAttribute(e.a
@andreasnymark
andreasnymark / Kirby CMS blog; get all posts
Created June 12, 2013 19:45
Blog roll. Show all post by default, to filter by tag and show archive per year. The blog is structured “…/blog/year/post”; hence the […]->children()->children()
<?php
if(param('tag')) {
// all tags are linked “…/weblog/tag:example”
$posts = $page
->children()
->children()
->visible()
->filterBy('tags', urldecode(param('tag')), ',')
->flip();
@andreasnymark
andreasnymark / Kirby CMS; dropdown nav with parent as label
Created May 24, 2013 06:14
Creates a dropdown meny, with the current top level parent as the label in the dropdown and displaying all other top level parents.
<?php
// current open
$curr = $page->uid();
?>
<nav role="main">
<ul id="nav-main" class="loop-a-stacked">
<li class="dropdown is-active"><?php echo $pages->findOpen()->menu() ?>
<ul class="dropdown-nav loop-a-stacked">