Skip to content

Instantly share code, notes, and snippets.

View julianwachholz's full-sized avatar
🤓

Julian Wachholz julianwachholz

🤓
View GitHub Profile
@julianwachholz
julianwachholz / HsgCrm.php
Created May 14, 2013 08:52
you've got to be fucking kidding me.
if (is_array($soapResultObject->Body->ExecuteResponse->ExecuteResult->Results->KeyValuePairOfstringanyType->value->Entities->Entity)) {
foreach ($soapResultObject->Body->ExecuteResponse->ExecuteResult->Results->KeyValuePairOfstringanyType->value->Entities->Entity as $entity) {
$entities_array[] = $this->findByUid($entity->LogicalName->LogicalName, $entity->Id->Id, $convertToClass);
}
} elseif (isset($soapResultObject->Body->ExecuteResponse->ExecuteResult->Results->KeyValuePairOfstringanyType->value->Entities->Entity)) {
$entity = $soapResultObject->Body->ExecuteResponse->ExecuteResult->Results->KeyValuePairOfstringanyType->value->Entities->Entity;
$entities_array[] = $this->findByUid($entity->LogicalName->LogicalName, $entity->Id->Id, $convertToClass);
}
{% compress js %}
<script src="/static/coffee/app.coffee" type="text/coffeescript" charset="utf-8"></script>
{% endcompress %}
<?php
use ActionController; // etc..
/**
* Example controller
*/
class EventController extends ActionController {
public function invitePeopleFormAction(SearchForm $searchForm = NULL) {
// check individual properties of $searchForm, e.g. $searchForm->getEvent()
@julianwachholz
julianwachholz / GroupsRepository.php
Last active December 16, 2015 01:09
Mind you, most of this does absolutely nothing or could be rewritten in two lines.
<?php
/**
* Explodes an XPath into an Array / only 2 Levels
* @param array $xpath
* @param boolean $utf8Encode
* @return array
*/
private function titleExploder($xpath, $utf8Encode = TRUE) {
$exTitle = explode('/', $xpath);
<?php
$SQL = "INSERT INTO `productgroups` ";
$SQL .= "( ";
$SQL .= "`xmlid`,";
$SQL .= "`lang`,";
$SQL .= "`title`";
$SQL .= ") ";
$SQL .= "VALUES ( ";
$SQL .= "'".mysql_real_escape_string($_POST['group']['xmlid'])."', ";
$SQL .= "'".mysql_real_escape_string($_POST['group']['lang'])."', ";
<?php
function _applyPlugin($function, $args) {
foreach ($this->plugins as $plugin) {
if (method_exists($plugin, $function)) {
switch (count($args)) { // call_user_func_array() doesn't work well with references
case 0: $return = $plugin->$function(); break;
case 1: $return = $plugin->$function($args[0]); break;
case 2: $return = $plugin->$function($args[0], $args[1]); break;
case 3: $return = $plugin->$function($args[0], $args[1], $args[2]); break;
case 4: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3]); break;
@julianwachholz
julianwachholz / app.scss
Last active December 15, 2015 14:29
Many different class names that need similar rules. Easy solution with SCSS.
$categories: (
'somecategory' $yellow,
'othercategory' $green,
'thirdcategory' $blue
);
@function category-classes($prefix: '') {
$classes: ();
@each $category in $categories {
$name: nth($category, 1);
@julianwachholz
julianwachholz / gist:5211963
Created March 21, 2013 10:06
We're lazy, SSH is verbose. Use this. ;)
~ cat .ssh/config
Host client
Hostname some-client-prd.example.com
User julian.wachholz
IdentityFile ~/.ssh/id_work
@julianwachholz
julianwachholz / urls.py
Created March 16, 2013 19:53
Conditional urls?
if settings.DEBUG:
urlpatterns += patterns(
'',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT,
}),
)
/**
* Fills in the markerArray with data for a news item
*
* @param array $row : result row for a news item
* @param array $textRenderObj : conf vars for the current template
* @param [type] $textRenderObj: ...
* @return array $markerArray: filled marker array
*/
function getItemMarkerArray($row, $lConf, $textRenderObj = 'displaySingle') {