Skip to content

Instantly share code, notes, and snippets.

@twosixcode
twosixcode / Craft Select Dropdown State field
Last active August 21, 2023 20:32
Paste this JSON into the settings field in the Craft CMS database "fields" table for your "Dropdown" field
{"options":[{"label":"Alabama","value":"AL","default":""},{"label":"Alaska","value":"AK","default":""},{"label":"American Samoa","value":"AS","default":""},{"label":"Arizona","value":"AZ","default":""},{"label":"Arkansas","value":"AR","default":""},{"label":"California","value":"CA","default":""},{"label":"Colorado","value":"CO","default":""},{"label":"Connecticut","value":"CT","default":""},{"label":"Delaware","value":"DE","default":""},{"label":"District Of Columbia","value":"DC","default":""},{"label":"Federated States Of Micronesia","value":"FM","default":""},{"label":"Florida","value":"FL","default":""},{"label":"Georgia","value":"GA","default":""},{"label":"Guam","value":"GU","default":""},{"label":"Hawaii","value":"HI","default":""},{"label":"Idaho","value":"ID","default":""},{"label":"Illinois","value":"IL","default":""},{"label":"Indiana","value":"IN","default":""},{"label":"Iowa","value":"IA","default":""},{"label":"Kansas","value":"KS","default":""},{"label":"Kentucky","value":"KY","default":""},{"
@twosixcode
twosixcode / entry_titles
Created November 18, 2012 23:34
Linked list of recent entry titles in Blocks
<h2>Previously... </h2>
<ul>
{% for entry in blx.entries.find({section: 'Blog', limit: '100', order: 'postDate desc'}) %}
<li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
{% endfor %}
</ul>
@twosixcode
twosixcode / entry_titles
Created November 18, 2012 23:34
Linked list of recent entry titles in Blocks
<h2>Previously... </h2>
<ul>
{% for entry in blx.entries.find({section: 'Blog', limit: '100', order: 'postDate desc'}) %}
<li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
{% endfor %}
</ul>
@twosixcode
twosixcode / icon.css
Created September 27, 2012 16:46
Clean way to add icon font using :before pseudoclass
/* Use the following CSS code if you want to have a class per icon */
[class^="icon-"]:before,
[class*=" icon-"]:before,
[class^="icon-"]:after,
[class*=" icon-"]:after {
font-family: 'Pictos';
font-style: normal;
speak: none;
}
.icon-comment:before {
@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" }
@twosixcode
twosixcode / gist:1694931
Created January 28, 2012 16:28
Global variables for current uri and current url in ExpressionEngine
// add to index.php
// current_url and current_uri global variables
$assign_to_config['global_vars'] = array(
'current_url'=>'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],
'current_uri'=>$_SERVER['REQUEST_URI']
);
@twosixcode
twosixcode / .gitignore
Created January 28, 2012 16:18
.gitignore for ExpressionEngine
.DS_Store
# Images
images/avatars/
images/captchas/
images/smileys/
images/member_photos/
images/signature_attachments/
images/pm_attachments/