Skip to content

Instantly share code, notes, and snippets.

View michaelorionmcmanus's full-sized avatar

Michael McManus michaelorionmcmanus

View GitHub Profile
@michaelorionmcmanus
michaelorionmcmanus / gist:6de0a7123a453d58a1c9
Last active August 29, 2015 14:03
Django CMS placeholder
## in models.py
class Season(models.Model):
title = models.CharField(max_length=255)
season = models.IntegerField(choices=SEASONS, blank=True, null=True)
year = models.IntegerField(blank=True, null=True)
description = HTMLField(blank=True, null=True)
description_placeholder = PlaceholderField('base_content', related_name='season_description', blank=True, null=True)
calendar_file = FilerFileField(blank=True, null=True)
@michaelorionmcmanus
michaelorionmcmanus / ember-data.dependent-relations.js
Last active August 29, 2015 14:02 — forked from slindberg/ember-data.dependent-relations.js
Be blind to order of record arrays when checking dirtiness of dependent relation
/**
Ember Data: Dependent Relationships
This package extends Ember Data to support creating relationships
where a model's dirty state depends not only on its own attributes
but on the dirty state of models in dependent relationships as well.
```javascript
App.Thing = DS.Model.extend({
name : DS.attr('string'),
@michaelorionmcmanus
michaelorionmcmanus / pagination-mixin.js
Created April 29, 2014 00:33
simple pagination with query params new
export default Ember.Mixin.create({
// Register all the query parameters that the controller needs to know about.
queryParams: ['_start', '_limit'],
// Store our values.
_start: 0,
_limit: 10,
nextStart: 0,
previousStart: null,
@michaelorionmcmanus
michaelorionmcmanus / gist:4210750
Created December 5, 2012 00:39
Event singleton
define([
'underscore',
'backbone'
],
// Event Manager
function(_, Backbone) {
var vent = _.extend({}, Backbone.Events);
return {
__int64 number = 317584931803;
int divisor = 2;
while (number > 1) {
if (0 == (number % divisor)) {
number /= divisor;
divisor--;
}
divisor++;
}
// [i]divisor[/i] is the answer
<?php
function isPalindrome($number) {
$numberLength = strlen($number);
$isEven = $numberLength %2 == 0;
$isPalindrome = false;
while(true) {
$first = substr($number, 0, 1);
$last = substr($number, -1, 1);
<T3DataStructure>
<meta>
<langDisable>1</langDisable>
</meta>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>General</sheetTitle>
</TCEforms>
<T3DataStructure>
<meta>
<langDisable>1</langDisable>
</meta>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>General</sheetTitle>
</TCEforms>
/********************************************************************************************
* PLUGIN IDENTITY AND DEFAULTS
*******************************************************************************************/
t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Plazm');
$extensionName = t3lib_div::underscoredToUpperCamelCase($_EXTKEY);
$pluginSignature = strtolower($extensionName) . '_archives';
/********************************************************************************************
* FLEXFORMS
ajax = PAGE
ajax {
# You don't need to change this typeNum
typeNum = 1249058000
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/json
xhtml_cleaning = 0
admPanel = 0
}