Skip to content

Instantly share code, notes, and snippets.

View harmstyler's full-sized avatar

Tyler Harms harmstyler

View GitHub Profile
@harmstyler
harmstyler / brew --config
Created May 25, 2012 02:04
brew install subversion fails
HOMEBREW_VERSION: 0.9
HEAD: 6a0630ba933dade543cf9ab9ce561c4a2dd7c787
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit sandybridge
OS X: 10.7.4
Kernel Architecture: x86_64
Xcode: 4.3.2
GCC-4.0: N/A
GCC-4.2: N/A
state[AL]=ALABAMA
state[AK]=ALASKA
state[AZ]=ARIZONA
state[AR]=ARKANSAS
state[CA]=CALIFORNIA
state[CO]=COLORADO
state[CT]=CONNECTICUT
state[DE]=DELAWARE
state[DC]=DISTRICT OF COLUMBIA
state[FL]=FLORIDA
@harmstyler
harmstyler / handleXmlField.php
Created October 18, 2012 14:42
Handle xml fields in eZ Publish
function handleXmlField($bodyXml, $parser="simple")
{
$parser = new eZSimplifiedXMLInputParser(null);
if ($parser == 'oe') {
$parser = new eZOEInputParser(null);
}
$parser->setParseLineBreaks(false);
$document = $parser->process($bodyXml);
@harmstyler
harmstyler / imageParse.php
Created October 22, 2012 15:08
Function for parsing eZ Images
if (isset($_FILES['photos']) && !empty($_FILES['photos']['tmp_name'])) {
foreach ($_FILES['photos']['tmp_name'] as $i=>$tmp) {
if (!$_FILES['photos']['tmp_name'][$i]) {
continue;
}
$fileName = $_FILES['photos']['name'][$i];
$guid = uniqid();
$path = '/tmp/jshwriteupload/' . $guid . '/';
@harmstyler
harmstyler / addTag.php
Created October 23, 2012 15:57
How eZ Tags adds tags
function add($parentTag, $newKeyword)
{
$db = eZDB::instance();
$db->begin();
$tag = new eZTagsObject( array( 'parent_id' => ( $parentTag instanceof eZTagsObject ) ? $parentTag->attribute( 'id' ) : 0,
'main_tag_id' => 0,
'keyword' => $newKeyword,
'depth' => ( $parentTag instanceof eZTagsObject ) ? (int) $parentTag->attribute( 'depth' ) + 1 : 1,
'path_string' => ( $parentTag instanceof eZTagsObject ) ? $parentTag->attribute( 'path_string' ) : '/' ) );
@harmstyler
harmstyler / addeztag.php
Created October 23, 2012 16:40
Storing eZ Tags
<?php
/**
 * Created by JetBrains PhpStorm.
 * User: tyler
 * Date: 1/6/12
 * Time: 4:33 PM
 * To change this template use File | Settings | File Templates.
 */
class AddeZTag
{
@harmstyler
harmstyler / embed-latest.tpl
Created October 30, 2012 18:22
Like if/else blocks?
{* Custom Embed template: Embed-Latest *}
{* User inserts an object, chooses embed-latest as view *}
{* Page viewer is then shown the most recent article or media_page under that object *}
{cache-block expiry=300 keys=array($object.id, $object.modified,$object.main_node_id)}
{def $article = fetch( 'content', 'list',
hash( 'parent_node_id', $object.main_node_id ,
'sort_by', array( 'published', false() ),
'class_filter_type', 'include',
'class_filter_array', array('media_page', 'article', 'link', 'blog_post'),
'limit', 1))}
@harmstyler
harmstyler / jw_player.html
Created November 5, 2012 20:18
Example of a JW Player install
<script type="text/javascript">
jwplayer("csps-video-0").setup({
logo: {hide: true},
height: 314,
width: 480,
controlbar: "bottom",
plugins: {
"timeslidertooltipplugin-1": {
displayhours: "true",
marginBottom: "22",
@harmstyler
harmstyler / ez-media.tpl
Created November 6, 2012 17:16
Javascript in eZ Templates with literals and variables
<div class="landing-video-surround">
<div class="audio-player" id="LandingPageVideo"></div>
</div>
<script type="text/javascript">
var videoURL = '{$video-url|trim}',
videoHeight = '{$player_height}',
videoWidth = '{$player_width}',
jwPlayer = {'javascript/player.swf'|ezdesign},
titleCard = '{$title-card-url}',
rtmpFile = '{$rtmp-file|trim}',
@harmstyler
harmstyler / build_query_params.js
Created April 5, 2013 16:33
Build a query string when given the params object
url = $.url();
params = url.param();
if (params.q != null) {
qs = buildQueryString(params);
}
buildQueryString = function(params) {
var param, qs;
qs = '';