Skip to content

Instantly share code, notes, and snippets.

View razbakov's full-sized avatar
🖖
Hi

Aleksey Razbakov razbakov

🖖
Hi
View GitHub Profile
<?php
/**
* Check if upload place exists
*
* @access private
* @param upload_place string
* @return string
*/
private function check_upload_place($upload_place)
{
@razbakov
razbakov / list.php
Last active December 20, 2015 08:59
<!-- Items list -->
<script type="text/javascript">
$(document).ready(function() {
// Drag-and-drop table with ordering feature
<?php if($table_rules['params']['ordered'] !== FALSE): ?>
$('#list_table').tableDnD({
onDrop: function(table, row) {
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="price" content="0.5900" />
</div>
@razbakov
razbakov / math.php
Last active December 18, 2015 10:29
<?php
class Math
{
var $operations = array(
'+' => 'plus',
'-' => 'minus',
'*' => 'multiply',
'/' => 'devide',
// add more functions here
);
@razbakov
razbakov / sql.sql
Last active December 18, 2015 10:29
SELECT mod(num,PAGE_SIZE) as row, ceil(num/PAGE_SIZE) as page
FROM (SELECT *, @rownum:=@rownum + 1 AS num FROM users, (SELECT @rownum:=0) r ORDER BY username) d
WHERE d.userid=141414
<?php
class Your_Module_Model_Observer
{
/**
* Get Captcha String
*
* @param Varien_Object $request
* @param string $formId
* @return string
*/
<?xml version="1.0"?>
<config>
...
<global>
<events>
<controller_action_predispatch_routename_controller_method>
<observers>
<module>
<class>module/observer</class>
<method>checkCaptcha</method>
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post" class="form">
...
<?php echo $this->getChildHtml('captcha'); ?>
...
</form>
<layout version="0.1.0">
<contacts_index_index translate="label">
<label>Contact Us Form</label>
<reference name="root">
<action method="setTemplate"><template>page/3columns.phtml</template></action>
<action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>
<reference name="content">
<block type="core/template" name="contactForm" template="contacts/form.phtml">
<block type="captcha/captcha" name="captcha">
<?php
$installer = $this;
$installer->startSetup();
Mage::register('isSecureArea', 1);
Mage::app()->setUpdateMode(false);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$db = Mage::getSingleton('core/resource')->getConnection('core_read');