Skip to content

Instantly share code, notes, and snippets.

@jekamozg
jekamozg / property.js
Created July 8, 2013 13:46
Default function argument in JS
function delete_property_image_hi_res(image_id, image_type)
{
image_type = image_type || 'hires';
@jekamozg
jekamozg / content_recipe.module
Created July 11, 2013 14:14
Drupal 7 taxonomy term link rewrite
/**
* Implementation of hook_entity_info_alter().
*
* Redirect any links to program taxonomy terms to their corresponding node page.
*/
function content_recipe_entity_info_alter(&$entity_info) {
$entity_info['taxonomy_term']['uri callback'] = 'content_recipe_taxonomy_term_uri';
}
/**
@jekamozg
jekamozg / class.manufacture.php
Created July 18, 2013 03:08
Insert or update query
"INSERT INTO SC_brands_categories (".implode(",", array_keys($c_value)).") VALUES(".implode(",", $c_value).") ON DUPLICATE KEY UPDATE ".implode(",", $update_array)
@jekamozg
jekamozg / CmsComponent.php
Created July 19, 2013 05:59
Curl example
/**
* Curl request
* @param type $url
* @return type
*/
public function getCurlResponse($url) {
$ch_req = curl_init();
curl_setopt($ch_req, CURLOPT_URL, $url);
curl_setopt($ch_req, CURLOPT_NOPROGRESS, 1);
curl_setopt($ch_req, CURLOPT_VERBOSE, 0);
@jekamozg
jekamozg / admin.js
Created August 6, 2013 09:53
Jquery UI sortable
$('.sort-entity').each(function () {
var e = $(this);
var url = e.data('url');
var entity = e.data('entity');
e.find('td').each(function(){
$(this).css('width', $(this).width() +'px');
});
e.sortable({
update: function (event, ui) {
var $postData = {};
<?php
/**
* Created by JetBrains PhpStorm.
* User: Marco Pivetta
* Date: 16.08.12
* Time: 11:05
* To change this template use File | Settings | File Templates.
*/
class CriteriaTest extends \PHPUnit_Framework_TestCase
{