Skip to content

Instantly share code, notes, and snippets.

@nunocodex
nunocodex / flatdoc-parameterize.js
Created September 6, 2016 16:56
Flatdoc Parameterize JS
var LATIN_MAP = {
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç':
'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I',
'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö':
'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U',
'Ý': 'Y', 'Þ': 'TH', 'ß': 'ss', 'à':'a', 'á':'a', 'â': 'a', 'ã': 'a', 'ä':
'a', 'å': 'a', 'æ': 'ae', 'ç': 'c', 'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e',
'ì': 'i', 'í': 'i', 'î': 'i', 'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó':
'o', 'ô': 'o', 'õ': 'o', 'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': 'u', 'ú': 'u',
'û': 'u', 'ü': 'u', 'ű': 'u', 'ý': 'y', 'þ': 'th', 'ÿ': 'y'
@nunocodex
nunocodex / GW2-AutoLoot.ahk
Created July 31, 2015 15:51
GuildWars 2 Auto Loot Script.
#SingleInstance force
#Persistent
#NoEnv
SetTimer, lootStuff, 250
return
lootStuff:
IfWinActive ahk_class ArenaNet_Dx_Window_Class
{
<?php
/**
* Twig engine for KirbyCMS
*
* @author Pereira Ricardo <hello@nunopress.com>
* @license MIT
*/
/**
@nunocodex
nunocodex / blog_item.html.twig
Created September 14, 2014 20:36
blog_item.html.twig
<div class="list-item">
<div class="list-blog-header">
{{ hook('blog.item.date.before') }}
<span class="list-blog-date">
<span>{{ page.date|date("d") }}</span>
<em>{{ page.date|date("M") }}</em>
</span>
@nunocodex
nunocodex / after.php
Created August 26, 2014 16:40
Remove page title from meta tag
<title><?php if(!$page->isHomePage()) : ?><?php echo html($page->title()) ?> | <?php endif; ?><?php echo html($site->title()) ?></title>
@nunocodex
nunocodex / site__snippets__header.php
Last active August 29, 2015 14:05
KirbyCMS blog tutorial
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title><?php if(!$page->isHomePage()) : ?><?php echo html($page->title()) ?> | <?php endif; ?><?php echo html($site->title()) ?></title>
<?php if($page_description = excerpt($page->text(), 100)) : ?>
@nunocodex
nunocodex / bootstrap.php
Last active August 29, 2015 13:57
Rewrite lexy parser for Rapido
<?php
$site = $this;
// Events
$site->on("site.init", function() use($site){
$site->viewvars["meta"] = (object) $site["config/site.meta"];
$site->viewvars["meta"]->route = $site["route"];
@nunocodex
nunocodex / bootstrap.php
Last active August 29, 2015 13:57
Custom routing with module implementation with cockpit / rapido
<?php
/* Load custom helpers */
require_once(__DIR__ . '/helpers.php');
/* Load custom config */
//$config = include(__DIR__ . '/config.php');
/* Load custom route */
require_once(__DIR__ . '/route.php');
@nunocodex
nunocodex / index.php
Created March 19, 2014 12:52
Routing implementation with language support for cockpit/rapido
<?php
/* Route to content mapping for projects with languages feature (ex. /en/projects) */
$site->bind("/:lang/projects", function($params) use($site) {
/* Define view */
$view = false;
/* Define route */
$route = str_replace('../', '', rtrim($site["route"], '/'));
@nunocodex
nunocodex / index.php
Last active June 17, 2019 14:10
Projects and Project implementation route for Cockpit and Rapido.
<?php
/* Route to content mapping for projects (ex. /projects) */
$site->bind("/projects", function() use($site) {
/* Define view */
$view = false;
/* Define route */
$route = str_replace('../', '', rtrim($site["route"], '/'));