Skip to content

Instantly share code, notes, and snippets.

View glideranderson's full-sized avatar

Robin Hjelmeir glideranderson

View GitHub Profile
@glideranderson
glideranderson / dropkick.js
Created November 27, 2012 14:30
Dropkick Js with added Keyboard Search (by Paritosh)
/**
* DropKick
*
* Highly customizable <select> lists
* https://github.com/JamieLottering/DropKick
*
* &copy; 2011 Jamie Lottering <http://github.com/JamieLottering>
* <http://twitter.com/JamieLottering>
*
* changes added from Paritosh Singh <https://github.com/paritosh90/>
@glideranderson
glideranderson / site.php
Created October 23, 2012 16:07
Custom Concrete5 config file
<?php defined('C5_EXECUTE') or die(_("Access Denied."));
$hosts = array(
'production' => 'production.com',
'staging' => 'staging.com',
'local' => 'local.dev'
);
if ($_SERVER['HTTP_HOST'] == $hosts['local']) {
define('DB_SERVER', '127.0.0.1');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
@glideranderson
glideranderson / _view.html.haml
Created October 22, 2012 20:07
Sortable items: side-by-side boxes with li items that are sortable and draggable
.span6
.dragging.connected{ 'data-slabel' => 'Personal Information' }
%h4
= link_to '#', class: 'add-all-fields floatright lightblue-btn tooltip-title', title:'Add All Questions' do
= raw '&#8594;'
= link_to '+', '#add-new-questions', class: 'add-new-question floatright green-btn tooltip-title', title:'Add New Question', role: 'button'
Personal Information
%span
Drag or Double Click to Add
= raw '&#8594;'
@glideranderson
glideranderson / boat_model.php
Created October 22, 2012 19:04
Concrete5 Get attribute set by handle, loop thru attribute keys, output key name and key value
<?php $attr_set = AttributeSet::getByHandle('boat_model_info'); ?>
<?php $attr_keys = $attr_set->getAttributeKeys(); ?>
<?php foreach($attr_keys as $ak) { ?>
<li class="spec-name"><?= $ak->akName ?></li>
<li class="spec-value"><?= $c->getAttribute($ak->akHandle) ?></li>
<?php } ?>
@glideranderson
glideranderson / wp-config.php
Created October 3, 2012 14:39
Wordpress Config File for local, staging, and production servers (so you can keep in your version control)
/* This wordpress config allows for local, staging and production database definitions
* Wordpress is in a directory called 'wp', while wp-content is outside the 'wp'
*
* This also allows for a crazy directory structure:
* for example: my staging was http://mydomain.com/clients/sitename/
* but the server http_host variable will only recognize mydomain.com
* wordpress still needs to know where my site lives, thus the path variable
*/
/* Servers */
@glideranderson
glideranderson / .gitignore
Created September 26, 2012 21:13
concrete5 gitignore on mac
.DS_Store
config/site.php
files/cache/*
files/tmp/*
@glideranderson
glideranderson / chrome_hack.js.coffee
Created September 19, 2012 17:53
Chrome hack to remove yellow autofill fields, but retain value
# hack to not show Chrome's yellow background on autofill form fields
if navigator.userAgent.toLowerCase().indexOf("chrome") >= 0
$(window).load ->
$('input:-webkit-autofill').each ->
$field = $(@)
parent = $field.closest '.control-group'
text = $field.val()
name = $field.attr 'name'
$field.after(this.outerHTML).remove()
parent.find("input[name='#{name}']").val(text);
@glideranderson
glideranderson / petphotouploader.js.coffee
Created August 22, 2012 21:24
pet file uploader in more oop manor
class PetPhotoUploader
# html5 multiple uploader with fallback
dom =
parent_wrapper: '.controls' # wrapper that contains all parent elements
parent: '.file-upload-wrapper' # container/wrapper of the file uploader
hidden_upload: '.hidden-upload' # hidden file input
file_text: '.file-text' # hidden wrapper notice to user which files they (will) uploaded
delete_file: '.delete-upload-file' # link to delete uploaded files
uploaded_count = 0 # total files uploaded
@glideranderson
glideranderson / pet_form.html.haml
Created August 22, 2012 17:38
html5 multiple file uploader js
.control-group.required.upload-photos
= f.label 'Upload files', required: false
.controls
.file-upload-wrapper
= link_to '#', class: 'file-upload red-btn' do
%i.icons.upload
Upload
= f.input :attachment,
as: :file,
wrapper_html: { class: 'hidden-upload' },
@glideranderson
glideranderson / app_views_comments_create.js.rjs
Created July 17, 2012 19:01
Fat Free CRM Creat Comment js
if @comment.valid?
page.insert_html :after, :comment_new, :partial => "comment", :locals => { :comment => @comment }
page[dom_id(@comment)].visual_effect :highlight, :duration => 1.5
end
page[:shown_notes].value = @comment.commentable.comment_ids.join(',')
page[:comment_comment].clear
page[:comment_comment].focus