Skip to content

Instantly share code, notes, and snippets.

View vrushank-snippets's full-sized avatar

Vrushank vrushank-snippets

View GitHub Profile
if(isset($_POST['matching_algo_run_time']) && !empty($_POST['matching_algo_run_time'])){
$algo_time = explode(':', $_POST['matching_algo_run_time']);
$hours = $algo_time[0];
$minutes = $algo_time[1];
$hour_12 = ($hours > 12) ? ($hours + 12) - 24 : $hours + 12;
if($hour_12 == 24)
$hour_12 = '00';
---------CRON JOB---------------------------------------------
#Bestee Import Products and Categories From Amazon every 5 Hours
00 */05 * * * curl -s -m 10 http://inheritx.dnsdynamic.com:8590/bestee/job/ImportAmazonProducts > /dev/null 2>&1
#Bestee Get The Score For Amazon Products After every 1 Hour
00 */01 * * * curl -s -m 10 http://inheritx.dnsdynamic.com:8590/bestee/job/TestFreakScoreMigration > /dev/null 2>&1
---------GET FAMILY TREE MYSQL CUSTOM FUNCTION------------------
DELIMITER $$
DROP FUNCTION IF EXISTS `GetChildren` $$
CREATE FUNCTION `GetChildren` (GivenID INT) RETURNS TEXT CHARSET latin1
DETERMINISTIC
BEGIN
DECLARE rv,q,strq,queue,queue_children TEXT;
@vrushank-snippets
vrushank-snippets / HTACCESS : Add www.
Last active July 17, 2019 10:55
HTACCESS : Add www. to the URL
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
----------GET ANCESTORS MYSQL CUSTOM FUNCTION------
DELIMITER $$
DROP FUNCTION IF EXISTS `GetAncestry` $$# MySQL returned an empty result set (i.e. zero rows).
CREATE FUNCTION `GetAncestry` (GivenID INT) RETURNS VARCHAR(1024)
DETERMINISTIC
BEGIN
DECLARE rv VARCHAR(1024);
DECLARE cm CHAR(1);
@vrushank-snippets
vrushank-snippets / UBUNTU : Install Elance Tracker
Created March 24, 2014 09:33
UBUNTU : Install Elance Tracker
Install Elance Tracker
------------------------
1. Download elance tracker from the elance for ubuntu.
2. Download Adobe Air
wget http://airdownload.adobe.com/air/lin/download/latest/AdobeAIRInstaller.bin
3. Provide proper permission
chmod +X AdobeAIRInstaller.bin
@vrushank-snippets
vrushank-snippets / jQuery: preview image
Created June 26, 2013 11:25
jQuery: preview image
// Preview Image
function preview(input)
{
if (input.files && input.files[0])
{
var reader = new FileReader();
reader.onload = function (e) {
$('#preview_image')
.attr('src', e.target.result)
<?PHP
/**
* Spintax - A helper class to process Spintax strings.
* @name Spintax
* @author Jason Davis - http://www.codedevelopr.com/
*/
class Spintax
{
public function process($text)
{
@vrushank-snippets
vrushank-snippets / PHP : ODD - EVEN CLASS
Created January 21, 2013 05:36
PHP : ODD - EVEN CLASS
for($i=0;$i<10;$i++)
{
echo "<div class=class".($xyz++%2).">Hello</div>";
}
// OR
for($j=0;$j<10;$j++)
{
$class = ($j%2 == 0)?'even':'odd';
@vrushank-snippets
vrushank-snippets / Yii : Date Picker
Created December 24, 2012 08:57
Yii : Date Picker
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name'=>'from_date',
'options'=>array(
'showAnim'=>'fold', // 'show' (the default), 'slideDown', 'fadeIn', 'fold'
'dateFormat'=>'dd-mm-yy',
'showOn'=>'button', // 'focus', 'button', 'both'
'buttonText'=>Yii::t('ui','Select form calendar'),
'buttonImage'=>Yii::app()->baseUrl.'/images/calendar.png',
'buttonImageOnly'=>true,