Skip to content

Instantly share code, notes, and snippets.

@davist11
davist11 / config.php
Last active December 13, 2015 18:18
ExpressionEngine: Don't show template debugging in AJAX requests
<?php
if(empty($_SERVER['HTTP_X_REQUESTED_WITH'])) {
$config['show_profiler'] = (ENV === 'local') ? 'y' : 'n';
$config['template_debugging'] = (ENV === 'local') ? 'y' : 'n';
}
@picdorsey
picdorsey / ee_freeform_composer_template_include
Created December 25, 2012 00:18
This is the embed code for the ee_freeform_composer_template: {embed="_includes/.form_columns" column_count="{composer:column_total}"}
{if embed:column_count == 1}
twelve columns
{/if}
{if embed:column_count == 2}
six columns
{/if}
{if embed:column_count == 3}
four columns
<div class="composer-form-container">
{composer:page}
{composer:rows}
{if freeform:general_errors}
<div class="row">
<div class="twelve columns">
<h5>There were some error(s) with your submission:</h5>
<ul>
{freeform:general_errors}
@madrobby
madrobby / gist:4161897
Created November 28, 2012 15:16
Retina screen media query
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 144dpi),
(min-resolution: 1.5dppx) {
/* Retina rules! */
}
@wilkie
wilkie / experiment.rb
Created November 19, 2012 23:51
Code to produce a probability distribution of how likely a gender breakdown in conference speakers is, and also to experiment to produce the result
# This program will select at random a set of speakers and look at the gender breakdown given 20% women
total_speakers = 15
percentage_of_women = 0.25
hist, list, results = {}, [], []
(1000 * (1 - percentage_of_women)).floor.times{list << 0}
(1000 * percentage_of_women).floor.times{list << 1}
@radiosilence
radiosilence / gist:4040553
Created November 8, 2012 18:19
RequireJS with Zurb Foundation
requirejs.config({
shim: {
'foundation/jquery.foundation.topbar': {
deps: ['jquery'],
},
'foundation/jquery.cookie': {
deps: ['jquery']
},
'foundation/jquery.event.move': {
deps: ['jquery']
<title>{title}{site_name}</title>
<meta name='keywords' content='{meta_keywords}' />
<meta name='description' content='{meta_description}' />
<link rel='canonical' href='{canonical_url}' />
<meta property="og:url" content="{canonical_url}"/>
<meta property="og:title" content="{entry_title}"/>
<meta property="og:description" content="{extra:desc}"/>
<meta property="og:image" content="{extra:image}"/>
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

{exp:query sql="
SELECT md.entry_id, cd.field_id_56, md.col_id_48
FROM exp_matrix_data AS md
LEFT JOIN exp_playa_relationships AS pr
ON md.entry_id = pr.parent_entry_id
LEFT JOIN exp_channel_data AS cd
ON pr.child_entry_id = cd.entry_id
WHERE md.field_id = 123
AND md.row_order = 1
GROUP BY md.entry_id
@ttscoff
ttscoff / planter.rb
Created September 22, 2012 17:57
Create directory trees from indented text input
#!/usr/bin/ruby
=begin
Planter v1.3
Brett Terpstra 2013
ruby script to create a directory structure from indented data.
Three ways to use it:
- Pipe indented (tabs or 2 spaces) text to the script
- e.g. `cat "mytemplate" | planter.rb
- Create template.tpl files in ~/.planter and call them by their base name