Skip to content

Instantly share code, notes, and snippets.

@Ranjanivraman
Ranjanivraman / manualtestdynamo.ts
Created February 14, 2020 12:14
Dynamodb read aws sdk
import { DynamoDB } from 'aws-sdk';
import { config } from 'aws-sdk';
import * as dotenv from 'dotenv';
dotenv.config();
async function test() {
config.update({
region: 'NOKEY',
secretAccessKey: 'NOKEY',
@Ranjanivraman
Ranjanivraman / phpini
Created July 13, 2019 17:08 — forked from nkgokul/phpini
Ubuntu php ini locations
/etc/php5/cli/php.ini is for the CLI PHP program, which you found by running php on the terminal.
/etc/php5/cgi/php.ini is for the php-cgi system which isn't specifically used in this setup.
/etc/php5/apache2/php.ini is for the PHP plugin used by Apache. This is the one you need to edit for changes to be applied for your Apache setup.
@Ranjanivraman
Ranjanivraman / .bashrc
Created July 13, 2019 17:06 — forked from nkgokul/.bashrc
Bash File to install on new servers
alias cd...="cd ../.."
alias cd....="cd ../../.."
alias cd.....="cd ../../../.."
alias chrome="open -a 'Google Chrome'"
alias emacs="emacs -nw"
var keepsHisWord;
keepsHisWord = true;
promise1 = new Promise(function(resolve, reject) {
if (keepsHisWord) {
resolve("The man likes to keep his word");
} else {
reject("The man doesnt want to keep his word");
}
});
console.log(promise1);
import { SQSEvent } from 'aws-lambda';
console.log('Loading function');
exports.handler = async (event: SQSEvent): Promise<void> => {
console.log('Received event:', JSON.stringify(event, null, 2));
for (const { messageId, body } of event.Records) {
console.log('SQS message %s: %j', messageId, body);
}
return `Successfully processed ${event.Records.length} messages.`;
@Ranjanivraman
Ranjanivraman / red-45
Created January 18, 2018 11:54
red-45
<?php
$productDescription = "ranjani, is a very good , girl in the town. She lives in england , india and china at the same time.";
echo $productDescription;
$productDescriptionStripped = str_replace(',','', $productDescription);
echo $productDescriptionStripped;
echo $productDescription;
<style type="text/css">
.rotateimg180 {
-webkit-transform:rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
}
</style>
@Ranjanivraman
Ranjanivraman / gist:bac8b11bbbe9107ef7f12fa1337e606c
Last active November 27, 2017 12:01
stock availability - MG-4061
explain SELECT `cataloginventory_stock_status`.`product_id`, `cataloginventory_stock_status`.`stock_status` FROM `cataloginventory_stock_status` WHERE (product_id IN('63376', '63377', '124450', '124451')) AND (stock_id=1) AND (website_id=1)
explain SELECT `l`.`product_id`, `l`.`parent_id` FROM `catalog_product_super_link` AS `l`
INNER JOIN `catalog_product_entity` AS `e` ON e.entity_id = l.product_id AND e.required_options = 0 WHERE (parent_id = '63378')
explain select product_id from catalog_product_super_link where parent_id = '63378'
explain select stock_status from cataloginventory_stock_status where stock_id = '1' and website_id = '1' and product_id IN (select product_id from catalog_product_super_link where parent_id = '63378')
@Ranjanivraman
Ranjanivraman / docker
Created November 23, 2017 14:11
mgdocker
stop & remove docker containers:
docker stop $(docker ps -a -q); docker rm $(docker ps -a -q); docker volume rm $(docker volume ls -qf dangling=true) ;
remove problematic networks:
docker network rm(docker network ls -q)
./reset.sh
@Ranjanivraman
Ranjanivraman / gist:b2dd57aa702c7efe7cd8f94c6ddbc5cd
Last active October 17, 2017 08:33
carlibybel redirect issue of products
-- G1802717 - denim jacket - blue
delete from enterprise_url_rewrite_redirect where target_path = 'catalog/product/view/id/631899’
delete from enterprise_url_rewrite where target_path = 'catalog/product/view/id/631899'
-- DD912972 - ribbed midi dress - cream
delete from enterprise_url_rewrite_redirect where target_path = 'catalog/product/view/id/638873’