Skip to content

Instantly share code, notes, and snippets.

if(post_password_required($post))
{
$context['post']->post_content = get_the_content();
}
@jacksonhoose
jacksonhoose / gist:7dff42ae15a08a9caeee
Last active August 29, 2015 14:01
Backbone View Error / /Uncaught TypeError: undefined is not a function when delegating events
View = Backbone.View.extend({
initialize: function() {
/*!
* set the collection
*/
this.collection = new dataCollection();
/*!
@jacksonhoose
jacksonhoose / gist:737d5a7a0a8d3db68cf1
Last active April 21, 2018 12:22
Paul Irish's Markup-based Unobtrusive Comprehensive DOM-ready Execution
var ODPHP = {};
ODPHP.common = {
init: function() {
// common code running on all pages
}
};
ODPHP.objective_search = {
init: function() {
<?php
if(class_exists('TimberMenu') && class_exists('TimberMenuItem'))
{
class MyMenu extends TimberMenu {
var $MenuItemClass = 'MyMenuItem';
}
var checkBoxToggle = {
init: function() {
this.checkBoxes = $('#showUnread, #showArchived');
this.tableBodies = $('div.dashboard-table tbody');
this.bindChange();
},
bindChange: function() {
this.checkBoxes.on('change', this.changeEvent.bind(this));
'use strict';
function LocationCtrl (locations) {
this.locations = locations.locations;
}
LocationCtrl.resolve = {
locations: function(Data) {
'use strict';
function LocationCtrl (resolvedLocation) {
this.locations = resolvedLocation;
}
LocationCtrl.resolve = {
resolvedLocation: function(Data) {
@jacksonhoose
jacksonhoose / gist:48d3c7601c3bbe4fa96b
Last active August 29, 2015 14:09
A nice way to vertically center content
<div class="auto-v-center">
<h2>Vertically Centered Stuff</h2>
<p>Indeed</p>
</div>
// scss
.auto-v-center {
@include inline-block(middle);
alphabet = function(charStart, charStop) {
charStart = charStart || 97;
charStop = charStop || 122;
var alphabet = [];
for(; charStart <= charStop; charStart++)
alphabet.push(String.fromCharCode(charStart))
return alphabet;
};
@jacksonhoose
jacksonhoose / documentDistance.js
Last active August 29, 2015 14:12
documentDistance
// Original version by Erik D. Demaine on January 31, 2011,
// based on code by Ronald L. Rivest (see docdist[1-7].py).
// Usage:
// node documentDistance.js file1.txt file2.txt
// # This program computes the "distance" between two text files
// # as the angle between their word frequency vectors (in radians).
// #
// # For each input file, a word-frequency vector is computed as follows: