Skip to content

Instantly share code, notes, and snippets.

View bobdenotter's full-sized avatar
🛠️
"Design is how it works, not how it looks."

Bob den Otter bobdenotter

🛠️
"Design is how it works, not how it looks."
  • Two Kings
  • The Hague, Netherlands
View GitHub Profile
@bobdenotter
bobdenotter / categories.twig
Created March 18, 2013 12:41
Show all categories in #bolt
{# the array of options, in config.. #}
{{ print(config.taxonomy.categories.options) }}
{# print all options #}
<ul>
{% for category in config.taxonomy.categories.options %}
<li>
<a href="{{ paths.root }}categories/{{category}}">{{category}}</a>
</li>
{% endfor %}
@bobdenotter
bobdenotter / buster.js
Created April 24, 2013 10:52
Bob's definitive Iframe buster buster BUSTER script. Note that the alert _is_ required. Depending on the sophistication of the iframe-buster-buster script, you might want to tweak the time-out (1000, in this case).
<script type="text/javascript">
if (top != self) {
setInterval("alert('Redirecting to example.org, please wait.');top.location.replace('http://example.org/')", 1000);
}
</script>
@bobdenotter
bobdenotter / mediaelement.twig
Last active August 22, 2017 21:55
Short example on how to use a MediaElement.js player with Bolt's 'video' field. First, just add a video in Bolt, like this: http://i.imgur.com/EnxqnW3.png . Then, use it in your template, like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mediaelement example</title>
<script src="{{ paths.theme }}javascripts/jquery-1.9.1.min.js"></script>
<script src="http://mediaelementjs.com/js/mejs-2.11.2/mediaelement-and-player.min.js"></script>
<link rel="stylesheet" href="http://mediaelementjs.com/js/mejs-2.11.2/mediaelementplayer.min.css" />
<link rel="stylesheet" href="http://mediaelementjs.com/js/mejs-2.11.2/mejs-skins.css" />
@bobdenotter
bobdenotter / loopfirst.twig
Created May 14, 2013 19:51
Using a loop, with loop.first to make the first one different..
{# get some records.. #}
{% setcontent records = "pages/latest/6" %}
{# use for to iterate over the records. #}
{% for record in records %}
{% if loop.first %}
{# first record is bigger.. #}
<article class="big">
@bobdenotter
bobdenotter / 5to9.twig
Last active December 17, 2015 08:18
How to display pages '5 through 9'..
{% setcontent records = "pages/latest/10" limit %}
{# use 'for' to iterate over the records. #}
{% for record in records %}
{# we only want '5 to 9' #}
{% if loop.index >= 5 and loop.index <= 9 %}
<article>
@bobdenotter
bobdenotter / gist:6320492
Last active December 21, 2015 14:38
Waarom een Wysiwyg editor soms niet doet, wat je (als eindgebruiker zijnde) verwacht.

Plakken en knippen sucks

Stel, je hebt een mooi stukje tekst in een word-achtig programma. Als je dit wilt plakken/knippen, dan komt er ongezien een hele berg aan meta-meuk mee zoals opmaak, lettertypes, en waarvandaan het geknipt is.

Als je het als 'platte tekst' invoegt in de meeste editors, dan ofwel slopen ze niet alle opmaak er uit, ofwel te veel. Meestal ziet het er dan zo uit:

Nimium boni est, cui nihil est mali. 

Qui autem esse poteris, nisi te amor ipse autem esse poteris, nisi te amor ipse
@bobdenotter
bobdenotter / extension.php
Last active April 21, 2016 15:30
extension to get JSON(p) from Bolt. use as `/json/pages?limit=1&callback=c`
<?php
// JsonInterface Extension for Bolt, by Bob den Otter
namespace JsonInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class Extension extends \Bolt\BaseExtension
{
@bobdenotter
bobdenotter / Preferences.sublime-settings
Last active December 26, 2015 01:29
Sublime settings
{
"always_show_minimap_viewport": false,
"bold_folder_labels": true,
"theme": "Afterglow.sublime-theme",
"color_scheme": "Packages/Theme - Afterglow/Afterglow.tmTheme",
"font_face": "Menlo",
"font_size": 14,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
alias dir='ls -alsG'
alias gpu="git pull; php composer.phar self-update; php composer.phar update;"
alias ip="echo -n 'local: '; ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'; echo -n 'external: '; curl ifconfig.me"
alias flushdns="dscacheutil -flushcache"
alias dotclean='find . -name ".DS_Store" -print0 | xargs -0 rm -rf; find . -name "._*" -print0 | xargs -0 rm -rf'
# Minder case-sensitive, en tab-completion gelijk bij eerste tab.
shopt -s nocaseglob
bind "set completion-ignore-case on"
bind "set show-all-if-ambiguous on"
@bobdenotter
bobdenotter / gist:10924751
Last active August 29, 2015 13:59
Git log for changelog format
git log --abbrev-commit --reverse --date=short HEAD...23c04e0ac --pretty=format:' - %d %s - %ad, %an ([%h](http://github.com/bolt/bolt/commit/%h))' > gitlog.md