Skip to content

Instantly share code, notes, and snippets.

View ClaudiuCreanga's full-sized avatar
💭
Hitting the gym

Claudiu Creanga ClaudiuCreanga

💭
Hitting the gym
View GitHub Profile
login url
<?php echo Mage::getUrl('customer/account/login'); ?>
logout url
<?php echo Mage::getUrl('customer/account/logout'); ?>
My Account url
<?php echo Mage::getUrl('customer/account'); ?>
Register url
console.log(JSON.stringify(obj, null, 4))
var width = 500;
height = 500;
widthScale = d3.scale.linear()
.domain([0,60])
.range([0,height]);
heightScale = d3.scale.linear()
.domain([60,0])
.range([0,height]);
axis = d3.svg.axis()
.ticks(5)
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/test.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info($object->debug());
$e = new \Exception;
echo "<pre>";
var_dump($e->getTraceAsString());
echo "</pre>";
die("test");
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
cmd shift fn f12 ----- hides everythings
cmd N ----- create file / class / directory
double shift ----- search everywhere
cmd O ----- go to a particular file / class /index. i.e Class.index or Class:41 for lines
Shift Cmd N ----- scratch files
shift cmd A ----- search for action
shift cmd -> ----- resize windows
ald shift up ----- move text up / down
shift cmd V ----- show clipboard
alt shift click ----- multiple cursors
# get max min of list
max(list)
min(list)
# sort a list
list.sort()
sorted(list)
# sort a list by a specific value
sorted(list, key = lambda x : x[2])
<?php
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');