Skip to content

Instantly share code, notes, and snippets.

View mssyogi's full-sized avatar
🎯
Focusing

Yogendra Kumar mssyogi

🎯
Focusing
View GitHub Profile
@mssyogi
mssyogi / server.js
Created March 18, 2020 12:14
securenodeserver
const express = require('express');
const fs = require('fs');
const path = require('path');
const cors = require('cors');
const compression = require('compression');
const helmet = require('helmet');
const morgan = require('morgan');
const Routes = require('./routes');
const Database = require('./database');
const logger = require('./config/logger');
@mssyogi
mssyogi / image zoom used in magento2
Created February 27, 2018 11:36
image zoom used in magento2
<!-- fotorama.css & fotorama.js. -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.css" rel="stylesheet"> <!-- 3 KB -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.js"></script> <!-- 16 KB -->
<!-- 2. Add images to <div class="fotorama"></div>. -->
<div class="fotorama" data-allowfullscreen="true" data-fit="scaledown" data-nav="thumbs">
<img src="https://s.fotorama.io/1.jpg">
<img src="https://s.fotorama.io/2.jpg">
SELECT id, 111.045 * DEGREES(ACOS(COS(RADIANS(@lat))
* COS(RADIANS(lat))
* COS(RADIANS(lng) - RADIANS(@lng))
+ SIN(RADIANS(@lat))
* SIN(RADIANS(lat))))
AS distance_in_km
FROM airports
ORDER BY distance_in_km ASC
LIMIT 0,5;
<script type="text/javascript">
$(document).ready(function(){
$('#hello-world').keyup(function(){
var ov = $(this).val();
if(ov){
if(ov.indexOf(",")!==-1){
// console.log(ov);
var nv='';
var tags = ov.split(",");
var i=-1;
@mssyogi
mssyogi / gist:75619f46e45952a659b1a724428a4d9c
Created January 24, 2018 06:18
Magento2 - Run from admin
<?php
$r = $_REQUEST['r'];
$root = getcwd();
if ($r == "flushcache") {
$cl = "php ". $root."/../n98-magerun2.phar cache:flush";
$results = shell_exec($cl);
echo $results;
}
@mssyogi
mssyogi / convert.php
Created December 20, 2017 13:08 — forked from nbriz/convert.php
convert image into base64 encoded string
<!DOCTYPE html>
<html>
<head>
<title> img to data</title>
<meta charset="utf-8">
<style>
textarea{ width: 50%; height: 200px; }
</style>
</head>
<body>
@mssyogi
mssyogi / MultiPartFromStrings.php
Created November 27, 2017 11:43 — forked from iansltx/MultiPartFromStrings.php
Multipart file uploads in PHP from strings
<?php
/**
* PHP's curl extension won't let you pass in strings as multipart file upload bodies; you
* have to direct it at an existing file (either with deprecated @ syntax or the CURLFile
* type). You can use php://temp to get around this for one file, but if you want to upload
* multiple files then you've got a bit more work.
*
* This function manually constructs the multipart request body from strings and injects it
* into the supplied curl handle, with no need to touch the file system.
@mssyogi
mssyogi / solrconfig.xml
Created June 2, 2016 10:30 — forked from arunchinnachamy/solrconfig.xml
Default SOLR Configuration file solrconfig.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@mssyogi
mssyogi / Narno_Mage_Extension.php
Created March 21, 2016 05:33 — forked from ArnaudLigny/Narno_Mage_Extension.php
Get download link of a Magento extension from MagentoConnect key.
<?php
/**
* Get download link of a Magento extension from MagentoConnect key
*
* Dependencies: Zend_Http_Client, Zend_Uri (Zend Framework)
*/
class Narno_Mage_Extension
{
protected $_key = null;
@mssyogi
mssyogi / gist:172c5d56064ca901e921
Created November 21, 2015 11:05 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array