Skip to content

Instantly share code, notes, and snippets.

View Vijaysinh's full-sized avatar
🌶️
Working from home

Vijaysinh Parmar Vijaysinh

🌶️
Working from home
View GitHub Profile
@Vijaysinh
Vijaysinh / File_upload.php
Last active September 3, 2019 06:31
File upload using CURL PHP
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" action="index.php" method="POST">
<p>Upload your file</p>
<input type="file" name="file"></input><br />
<input type="submit" value="Upload"></input>
@Vijaysinh
Vijaysinh / file_download.php
Last active January 4, 2021 06:46
Download Files from Remote Server DB
<?PHP
error_reporting(E_ALL);
ini_set('display_errors',1);
get_attachments();
if(isset($_GET['id']) && !empty($_GET['id'])){
$id = $_GET['id'];
$fileName = $_GET['file'];
@Vijaysinh
Vijaysinh / sorting_versions.py
Last active September 25, 2019 08:55
Sorting Api Version in python
from distutils.version import StrictVersion
#from operator import itemgetter
v1 = [{'ver': "1.1.12"},{'ver': "1.0.0"},{'ver': "1.3.3"},{'ver': "1.0.12"},{'ver': "1.0.2"}]
v1.sort(key=lambda x: StrictVersion(x['ver']),reverse=True)
print(v1)
versions = ["1.1.2", "1.0.0", "1.3.3", "1.0.12", "1.0.2"]
versions.sort(key=StrictVersion,reverse=True)
print(versions)
@Vijaysinh
Vijaysinh / Add_Audience_to_AdwordsAccount.php
Last active September 29, 2019 20:40
Google Adwords Adding Audiance to Google adwords account Visitors of a page
<?php
//https://github.com/googleads/googleads-php-lib/blob/8cd18b116b40127c91bb1d2679924c13d6b964f6/examples/AdWords/v201809/Remarketing/AddRuleBasedUserLists.php
//https://developers.google.com/adwords/api/docs/guides/remarketing#visitors_to_your_website
//https://developers.google.com/adwords/api/docs/reference/v201809/AdwordsUserListService.BasicUserList
///https://groups.google.com/forum/#!msg/adwords-api/-_dA7ZYVNiI/ebA9BXjkCwAJ
//https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v2.common#google.ads.googleads.v2.common.UserListInfo
//https://developers.google.com/adwords/api/docs/samples/php/remarketing#add-crm-based-user-list
use Google\AdsApi\AdWords\AdWordsServices;
use Google\AdsApi\AdWords\AdWordsSession;
use Google\AdsApi\AdWords\AdWordsSessionBuilder;
@Vijaysinh
Vijaysinh / bitbucket-ftp-pipelines.yml
Last active November 20, 2019 11:28
bitbucket2remoteFTP deploy
image: samueldebruyn/debian-git
pipelines:
default:
- step:
script:
- apt-get update
- apt-get -qq install git-ftp
- git ftp init --user $SITE_FTP_USER --passwd $SITE_FTP_PASS ftp://xyzsite.com/publichtml/repo/
@Vijaysinh
Vijaysinh / GoogleAdsMCCScriptLabels.js
Created November 20, 2019 11:25
GoogleAdsMCCScript for Labels
function main() {
// You can use this approach when you have only minimal processing to
// perform in each of your client accounts.
// Select the accounts to be processed.
var accountIterator = MccApp.accounts().get();
var arrayList=[];
// Save the MCC account, to switch back later.
@Vijaysinh
Vijaysinh / NewLineHTMLTitleAttributeTooltip.html
Last active May 14, 2020 06:15
New Line HTML Title Attribute
<!DOCTYPE html>
<html>
<body>
<p><abbr title="-Line 1&#010;-Line 2">Hover Me</abbr> My Name Is Vijaysinh.</p>
<p title="Bangalore">Bangalore</p>
</body>
</html>
@Vijaysinh
Vijaysinh / AdGroupCallExtension.php
Created June 24, 2020 08:09 — forked from jamesmills/AdGroupCallExtension.php
Google Adwords API. Creating a Call Extension for an AdGroup.
<?php
public function fire()
{
// See the Placeholder reference page for a list of all the placeholder types and fields.
// https://developers.google.com/adwords/api/docs/appendix/placeholders.html
define('PLACEHOLDER_SITELINKS', 1);
define('PLACEHOLDER_FIELD_SITELINK_LINK_TEXT', 1);
define('PLACEHOLDER_FIELD_SITELINK_URL', 2);
@Vijaysinh
Vijaysinh / Get_ads_KPIs_HourOfDay.py
Created October 6, 2020 06:26 — forked from lylayang/Get_ads_KPIs_HourOfDay.py
Get_ads_spend_HourOfDay.py
"""
Copyright (C) Lyla Yang - All Rights Reserved
Unauthorized copying of this file, via any medium is strictly prohibited
Proprietary and confidential
Written by Lyla Yang <https://www.linkedin.com/in/lyla-yang-aa850080/>, May 2019
"""
"""
Reference of field attributes
https://developers.google.com/adwords/api/docs/appendix/reports#field-attributes
@Vijaysinh
Vijaysinh / theme.js
Created November 19, 2020 10:23
toggle-theme-js
function setTheme(themeName) {
localStorage.setItem('theme', themeName);
document.documentElement.className = themeName;
}
// function to toggle between light and dark theme
function toggleTheme() {
if (localStorage.getItem('theme') === 'theme-dark') {
setTheme('theme-light');
} else {