Skip to content

Instantly share code, notes, and snippets.

View joelongstreet's full-sized avatar

Joe Longstreet joelongstreet

View GitHub Profile
@joelongstreet
joelongstreet / publication-view.js
Created September 18, 2013 14:23
publication-view.js
define([
'chaplin',
'views/base/view',
'models/newsletter',
'text!templates/publication.hbs'
], function(Chaplin, View, Newsletter, template){
'use strict';
var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
@joelongstreet
joelongstreet / publication-controller.js
Created September 18, 2013 14:24
publication-controller.js
define([
'controllers/base/controller',
'models/base/collection',
'models/base/model',
'views/publications-view',
'views/publication-view',
'views/newsletters-view'
], function(Controller, Collection, Model, PublicationsView, PublicationView, NewslettersView){
'use strict';
@joelongstreet
joelongstreet / CleanMicrosoftWordHtml.js
Created September 21, 2013 18:10
Cleans html when pasting text from Microsoft Word. Will remove all inline styling and extraneous markup attributes. Allows you to specify which html tags should be allowed.
// Pasting from Microsoft word is an ABSOLUTE DISASTER
// this method removes the endless gobs of garbage produced
// by the world's worst, yet most popular, text editor
var allowedTags = ['A', 'DIV', 'SPAN', 'B', 'I', 'EM', 'STRONG', 'P'];
var cleanHTML = function(htmlString){
// If it doesn't look like a tag, return the string
if(htmlString.charAt(0) != '<') return htmlString
try{ $(htmlString) }
catch(e){ return htmlString }
@joelongstreet
joelongstreet / stackato.yml
Last active December 24, 2015 02:39
sample stackato config
name: Gutenberg
requirements:
running:
unix:
- graphicsmagick
framework:
type: node
services:
fs_gutenberg_photos: filesystem
ignores: ["node_modules", ".git", "uploads", ".tmp"]
@joelongstreet
joelongstreet / ImageController.js
Created September 27, 2013 19:01
some description
/**
* ImageController
*
* @module :: Controller
* @description :: Contains logic for handling requests.
*/
var magik = require('gm');
var fs = require('fs');
var path = require('path');
completeTask:(e)=>
e.preventDefault() if e
e.stopPropagation() if e
@toggleStatus()
status = @model.get('status');
@model.save {
status: status
}, {
success: =>
unless @removeTaskTimeout
View = require 'views/base/view'
template = require 'views/templates/fanview/center/demographics'
module.exports = class Demographics extends View
template: template
template = null
autoRender: true
tagName: 'div'
className: 'accordion-inner row-fluid'
@joelongstreet
joelongstreet / garbage.m
Created October 10, 2013 20:42
garbage
/**
* Your Copyright Here
*
* Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc.
* and licensed under the Apache Public License (version 2)
*/
#import "TiModule.h"
#import "ComAudiosyncModule.h"
#import "TiBase.h"
#import "TiHost.h"
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'> <head> <custom name='opencounter' type='tracking'> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> <title>On the Radar - October 8, 2013 (Joe's Test)</title> </head> <body> <table width='600px' style='font-family:Helvetica, Arial, sans-serif; font-size:1em'; > <tr> <td colspan='5'><img src='http://f.cl.ly/items/440H2i061W2D143r190t/header.jpg' /></td> </tr> <tr> <td colspan='5' style='font-size:.8em; text-align:right; color:#636363;'>On the Radar - October 8, 2013 (Joe's Test)</td> </tr> <tr draggable='true' class='draggable' data-storyId='525d9190cb843f0000000001'> <td style='vertical-align:top;'> <img draggable='false' style='width:190px;' src='https://s3.amazonaws.com/gutenberg-vml/dffdc4e9c20dcec27c21503c79eb69e
@joelongstreet
joelongstreet / config.json
Created October 15, 2013 23:35
sample gutenberg config
[{"title":"Email","templates":{"preview":"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'> <head> <custom name='opencounter' type='tracking'> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> <title><%= newsletter.title %></title> </head> <body> <table width='600px' style='font-family:Helvetica, Arial, sans-serif; font-size:1em'; > <tr> <td colspan='5'><img src='http://f.cl.ly/items/440H2i061W2D143r190t/header.jpg' /></td> </tr> <tr> <td colspan='1' style='font-size:.8em; padding-bottom:15px;'><a href='#'>Read it Now on Passport</a></td> <% var modifiedTitle = newsletter.title.replace('On the Radar - ', '') %> <td colspan='4' style='vertical-align:top; font-size:.8em; text-align:right; color:#636363;'><%= modifiedTitle %></td> </tr> <% for(var i=0; i<stories.length; i++) {%> <% if(stories[i].sort_index