Skip to content

Instantly share code, notes, and snippets.

View martisj's full-sized avatar
🐊

Martin Sjåstad martisj

🐊
View GitHub Profile
martin at martmac-lion in ~
$ csv2po [17:34:15]
Traceback (most recent call last):
File "/usr/local/bin/csv2po", line 22, in <module>
from translate.convert import csv2po
ImportError: cannot import name csv2po
FAIL no 1
@martisj
martisj / cmshome
Created April 23, 2014 18:13
cms home page
<reference name="header">
<block type="core/template" name="home-seasonal-links" as="home-seasonal-links" template="additional/home-seasonal-links.phtml">
<!-- <action method="setData"><name>categoryid</name><value>3,4,5</value></action> -->
</block>
<block type="cms/block" name="home-panel" as="home-panel">
<action method="setBlockId"><block_id>home-panel</block_id></action>
</block>
</reference>
@martisj
martisj / home.php
Created April 24, 2014 07:04
email validation form
public function request_a_demo() {
$data = array();
$data['for_universities_section'] = TRUE;
$this->form_validation->set_rules('name', 'Name', 'trim|required');
$this->form_validation->set_rules('institution', 'University/College', 'trim|required');
$this->form_validation->set_rules('position', 'Position', 'trim|required');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
if ($this->form_validation->run() == FALSE)
<div class="content pad request_a_demo_page">
<div class="text">
<form action="" class="public-form" id="request-demo" method="post">
<fieldset>
<legend>Request a Demo</legend>
<p>All fields are required</p>
<ol>
<li>
<label for="name">Name</label>
@martisj
martisj / mysql4-install-0.1.0.php
Last active August 29, 2015 14:01
Add Attribute to attributeset default and group general
<?php
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
// Add attributes to the various sets
$attributeId = $setup->getAttribute('catalog_product', 'teaser');
$attributeSetId = $setup->getAttributeSetId('catalog_product', 'Default');
//Get attribute group info
$attributeGroupId = $setup->getAttributeGroup('catalog_product', $attributeSetId, 'General');
@martisj
martisj / Setup.php
Created May 12, 2014 11:41
class name for module resource setup
<?php
class Pointbreak_BoardCategory_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup {
}
@martisj
martisj / config.xml
Created May 12, 2014 14:34
data resource setup
<config>
<modules>
<Pointbreak_BoardCategory>
<version>0.1.0</version>
</Pointbreak_BoardCategory>
</modules>
<global>
<resources>
<boardcategory_setup>
<setup>
@martisj
martisj / data-install-0.1.0.php
Last active August 29, 2015 14:01
adding attribute to set
<?php
// die('dont do this now');
/**
* Helper methods
*/
function reindexAllIndices() {
for ($i = 1; $i <= 9; $i++) {
$process = Mage::getModel('index/process')->load($i);
$process->reindexAll();
@martisj
martisj / Convert photoshop tracking to CSS letter-spacing
Last active August 29, 2015 14:16
A mixin to help my forgetful brain convert Photoshop tracking settings from the `Character` panel to meaningful CSS letter-spacing.
@mixin psd-tracking($tracking) {
letter-spacing: #{$tracking / 1000}em;
}
// To use do: `@include psd-tracking(50);` if your Photoshop character panel says 60.
@martisj
martisj / SassMeister-input-HTML.html
Created May 20, 2015 12:12
Generated by SassMeister.com.
<div class="volume-estimator-output">
<p class="text-center">You will love</p>
<p id="volume-result" class="readonly-output">0</p>
<p class="text-center">Litres</p>
</div>