Skip to content

Instantly share code, notes, and snippets.

danieliser /
Created June 26, 2014 00:08 — forked from jookyboi/
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.


  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
danieliser /
Created June 26, 2014 00:08 — forked from jookyboi/
CSS libraries and guides to bring some order to the chaos.


  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.


danieliser / Serialize Form Array to Object.js
Created June 26, 2014 00:13
Converts all form elements into a serialized javascript array object. field[key][category][name] becomes
function serialize_form($form){
var serialized = {};
jQuery("[name]", $form).each(function () {
var name = jQuery(this).attr('name');
var value = jQuery(this).val();
var nameBits = name.split('[');
var previousRef = serialized;
for(var i = 0, l = nameBits.length; i < l; i++) {
var nameBit = nameBits[i].replace(']', '');
danieliser / es5.js
Last active February 27, 2024 23:11
Convert Hex Color to rgba with opacity
* ECMA2015
function convertHex(hexCode, opacity = 1){
var hex = hexCode.replace('#', '');
if (hex.length === 3) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
danieliser / filter_remove-my-modal.php
Last active June 3, 2016 23:57
Filter example: remove a modal when user is logged in.
add_filter('emodal_print_modals', 'remove_my_modal');
function remove_my_modal($modals)
$id_of_hidden_modal = 2;//The id of your modal.
jQuery(document).ready(function () {
jQuery('#eModal-1, #eModal-2, #eModal-3, #eModal-4, #eModal-5, #eModal-6').find('button, .button').click(function (e) {
danieliser / functions.php
Last active June 3, 2016 23:58
Custom Post Type Support Filter
add_filter('emodal_post_types', 'my_custom_post_types_for_emodal');
function my_custom_post_types_for_emodal($post_types)
$post_types[] = 'portfolio-items';
return $post_types;
// Copy everything below here to your functions.php file.
add_filter('emodal_admin_submenu_themes_capability', 'fix_my_emodal_theme_menu');
function emodal_admin_submenu_themes_capability($capability) {
return 'edit_posts';

Towards a data model for scalable queries against rich WordPress post attribute data

This document is in draft status, and is being made available for peer review. If you have feedback, feel free to comment directly on this gist or email me directly.

Say you have an object with a complex, idiosyncratic attribute structure. Let's say you're a web developer, and a client of yours is a gemstone dealer in Manhattan. They have an inventory of gemestones that needs to be tracked.

Gemstones have a rich plethora of attributes. Gemstone type (e.g. sapphire or emerald), price, weight, width, height, depth, color, shape, country of origin, treatment (if it's heat treated),

danieliser / prevent-post-delete.php
Created March 2, 2015 08:36
Prevent users from deleting a specific page, post or CPT in WordPress.
function prevent_default_theme_deletion($allcaps, $caps, $args) {
$post_id = 123;
if ( isset( $args[0] ) && isset( $args[2] ) && $args[2] == $post_id && $args[0] == 'delete_post' ) {
$allcaps[ $caps[0] ] = false;
return $allcaps;
add_filter ('user_has_cap', 'prevent_default_theme_deletion', 10, 3);