Skip to content

Instantly share code, notes, and snippets.

@samhernandez
samhernandez / haxor.twig
Last active December 2, 2022 21:40
Craft 3 gain access to admin account for support cases or when owner loses access
{#
Resets the username, password, and email address
of the first found Admin account in case of
lost admin access or for support cases.
#}
{% set values = {
username: 'me',
password: craft.app.security.hashPassword('mypassword'),
email: 'me@site.com',
passwordResetRequired: 0
@Harry-Harrison
Harry-Harrison / countries.json
Last active December 3, 2020 15:27
Freeform Craft select field for countries of Earth.
[{"label":"Afghanistan", "value":"Afghanistan"},{"label":"Aland Islands", "value":"Aland Islands"},{"label":"Albania", "value":"Albania"},{"label":"Algeria", "value":"Algeria"},{"label":"American Samoa", "value":"American Samoa"},{"label":"Andorra", "value":"Andorra"},{"label":"Angola", "value":"Angola"},{"label":"Anguilla", "value":"Anguilla"},{"label":"Antarctica", "value":"Antarctica"},{"label":"Antigua and Barbuda", "value":"Antigua and Barbuda"},{"label":"Argentina", "value":"Argentina"},{"label":"Armenia", "value":"Armenia"},{"label":"Aruba", "value":"Aruba"},{"label":"Australia", "value":"Australia"},{"label":"Austria", "value":"Austria"},{"label":"Azerbaijan", "value":"Azerbaijan"},{"label":"Bahamas", "value":"Bahamas"},{"label":"Bahrain", "value":"Bahrain"},{"label":"Bangladesh", "value":"Bangladesh"},{"label":"Barbados", "value":"Barbados"},{"label":"Belarus", "value":"Belarus"},{"label":"Belgium", "value":"Belgium"},{"label":"Belize", "value":"Belize"},{"label":"Benin", "value":"Benin"},{"label":"B
@brandonkelly
brandonkelly / templating.md
Last active February 7, 2024 15:20
Templating in EE vs. Craft
@adamwiggall
adamwiggall / Keep Directories
Last active December 20, 2015 18:38
Often you have a directory in a git repo that you want to share amongst developers, but you don't want the contents tracked. As git ignores empty directories, if you just .gitignore the directory completely it will never get added to the repo and shared. The example shows how to use this technique for the cache folder in an expressionengine inst…
From the command line
$ touch your/path/to/expressionengine/cache/.gitkeep
In your .gitignore file
your/path/to/expressionengine/cache/*
!your/path/to/expressionengine/cache/.gitkeep
@davist11
davist11 / ext.php
Last active December 16, 2015 22:09
EE Entry previewing
<?php
public function sessions_end($session)
{
if ($session->userdata['can_access_cp'] === 'y') {
$new_global_vars['gv_can_preview'] = TRUE;
} else {
$new_global_vars['gv_can_preview'] = FALSE;
}
@low
low / low-search-ajax.js
Last active October 18, 2020 13:21
Using Low Search for ExpressionEngine with Ajax. Change any of the three variables on top to suit your needs. Tested with jQuery 1.9.0.
(function($){
$(function(){
var $form = $('#search'), // Search form
$target = $('#results'), // Results container
rp = 'search/ajax-results'; // Template for results only
// Function to execute on success
var success = function(data, status, xhr) {
$target.html(data);
};
@pauloelias
pauloelias / README.md
Created August 23, 2012 16:57
Extended ExpressionEngine .htaccess/apache conf

ExpressionEngine .htaccess/Apache conf

Please use these at your own risk. I cannot be responsible for having no idea what I am doing and breaking your server.

This is a collection of Apache configuration settings that I use in my ExpressionEngine projects. Since I have always been a big fan of the HTML5 Boilerplate I took inspiration from their .htaccess file and tweaked my configuration with other settings I have used over the years.

This gist contains:

  • _EXTENDED.htaccess This is a general .htaccess file I rename and edit as needed for each site. Note: When I host a site on my prad/stage/dev servers I move most or all of these rules into the vhost.conf file
  • _SAMPLE.httpd.conf I use Ubuntu on my development, staging, and production servers so this is specific to Apache 2 on my setup. Essentially this file extends the apache2.conf (in my setup).
@twosixcode
twosixcode / gist:1988097
Created March 6, 2012 18:40
Make "Paste and Indent" the default paste in Sublime Text 2
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
@siffring
siffring / .htaccess
Created March 4, 2012 17:33
htaccess to password protect a specific server
# ----------------------------------------------------------------------
# Password protect staging server
# Use one .htaccess file across multiple environments
# (e.g. local, dev, staging, production)
# but only password protect a specific environment.
# ----------------------------------------------------------------------
SetEnvIf Host staging.domain.com passreq
AuthType Basic
AuthName "Password Required"
@etrepat
etrepat / FIle.sublime-settings.json
Created October 15, 2011 18:44
Sublime Text 2 - My Settings
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
// specific settings file, for example, "Base File (Linux).sublime-settings".
// Because of this, setting them here will have no effect: you must set them
// in your User File Preferences.
"font_face": "Monaco",
"font_size": 12,