Skip to content

Instantly share code, notes, and snippets.

View bcartier's full-sized avatar

Brent Cartier bcartier

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active July 29, 2024 01:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@bastianallgeier
bastianallgeier / multilangcontent.php
Last active September 17, 2015 02:25
In Kirby's multi-lang version it is super easy to fetch content from different languages in a template.
<?php snippet('header') ?>
<h2>English Version</h2>
<h3><?php echo $page->content('en')->title()->html() ?></h3>
<?php echo $page->content('en')->text()->kirbytext() ?>
<h2>German Version</h2>
<h3><?php echo $page->content('de')->title()->html() ?></h3>
@clsource
clsource / 401-response.php
Created July 30, 2014 19:55
Helper for Creating REST Web Services with ProcessWire
<?php
/*
* 401 Response
*
* Sends a 401 Response Unauthorized
*
* @author Camilo Castro
*
* @date 29/07/2014
@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
@biilmann
biilmann / instructions.md
Created September 26, 2011 12:00
Multi language extension for Webpop

Multi language extension

This is a small extension for handling sites where the contents have translated fields.

To use it copy lang.js to the extensions folder and select lang.js as the extension for the home section of your website.

Edit the "defaultLang" and the "languages" array in the extension to setup a main language for your site and a series of alternative languages. You currently need to use 2 letter codes for the languages for the extension to work properly.

Making your content multi-language

@biilmann
biilmann / Readme.md
Created June 27, 2011 18:49
Form extension for Webpop

Forms with the Contact extension

This contact extension for Webpop is based on writing HTML5 forms with all the validations the HTML5 spec introduces, and having Webpop carry out the validations server-side in case the browser doesn't support them (or has been sidestepped completely).

To use it, simply copy "contact.js" into the Extensions folder of your project.

Writing forms with the <pop:contact> extension is very straight forward, and while the extension can easily be used to output forms with a predefined markup, every part of the final html can be handcrafted.

Here's a simple contact form:

@anthonyshort
anthonyshort / css-responsive-images-alt.html
Created May 19, 2011 00:29 — forked from necolas/css-responsive-images.html
Idea for CSS-only responsive images using CSS3 generated content and attr() function. No browser implementation as of May 2011
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS responsive images</title>
<style>
/* Play nice with existing requirements for
Responsive Images polyfill */
/* Doesn't stop original source image being
<?php
// import a pipe delimited list of entry ids into your custom field
// this is the column name of your Playa field
$ee_column = 'field_id_160';
global $DB;
$rels = array();
$entries_query = $DB->query("SELECT entry_id, $ee_column FROM exp_weblog_data WHERE $ee_column");
$entries = $entries_query->result;