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 / pg-build-api
Last active August 29, 2015 14:25 — forked from scottopolis/pg-build-api
Phonegap Build Developer API (php curl)
<?php
class PGB_API {
// A single instance of this class.
public static $instance = null;
public static $auth_token = '';
/**
* Creates or returns an instance of this class.
@mssyogi
mssyogi / README.md
Created October 2, 2015 13:10 — forked from shancarter/README.md
A Simple HTML Slider With D3

DESCRIPTION

A simple d3.js slider

@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
@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 / 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 / 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 / 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 / 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;
}
<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;
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;