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 / timezones_array.php
Created May 13, 2022 18:15 — forked from pavellauko/timezones_array.php
Time zones as arrays (PHP)
<?php
$timezones = array(
'America/Adak' => '(GMT-10:00) America/Adak (Hawaii-Aleutian Standard Time)',
'America/Atka' => '(GMT-10:00) America/Atka (Hawaii-Aleutian Standard Time)',
'America/Anchorage' => '(GMT-9:00) America/Anchorage (Alaska Standard Time)',
'America/Juneau' => '(GMT-9:00) America/Juneau (Alaska Standard Time)',
'America/Nome' => '(GMT-9:00) America/Nome (Alaska Standard Time)',
'America/Yakutat' => '(GMT-9:00) America/Yakutat (Alaska Standard Time)',
'America/Dawson' => '(GMT-8:00) America/Dawson (Pacific Standard Time)',
<?php
//Dependency Inversion SOLID Principle
interface DBConnectionInterface {
public function connect();
}
class MySQLConnection implements DBConnectionInterface {
public function connect() {
@Vijaysinh
Vijaysinh / jenkins.template
Created September 3, 2021 02:39 — forked from JosephMaxwell/jenkins.template
Jenkins CloudFormation Template (more information and tutorial videos at https://swiftotter.com/technical/running-jenkins-on-amazon-ec2-with-cloudformation)
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Launches a Jenkins server.",
"Parameters": {
"InstanceType": {
"Description": "EC2 instance type",
"Type": "String",
"Default": "t2.small",
"AllowedValues": [
"t1.micro",
@Vijaysinh
Vijaysinh / RDS-Aurora-CloudFormation-Example.yaml
Created August 27, 2021 10:01 — forked from sjparkinson/RDS-Aurora-CloudFormation-Example.yaml
A basic CloudFormation template for an RDS Aurora cluster.
---
AWSTemplateFormatVersion: 2010-09-09
Description: >
A basic CloudFormation template for an RDS Aurora cluster.
Parameters:
DatabaseUsername:
AllowedPattern: "[a-zA-Z0-9]+"
ConstraintDescription: must be between 1 to 16 alphanumeric characters.
@Vijaysinh
Vijaysinh / AWS_S3_Presign_Download.php
Created August 6, 2021 07:16 — forked from anthonyeden/AWS_S3_Presign_Download.php
AWS S3: Pre-sign Upload & Download Requests [PHP]
<?php
function AWS_S3_PresignDownload($AWSAccessKeyId, $AWSSecretAccessKey, $BucketName, $AWSRegion, $canonical_uri, $expires = 8400) {
// Creates a signed download link for an AWS S3 file
// Based on https://gist.github.com/kelvinmo/d78be66c4f36415a6b80
$encoded_uri = str_replace('%2F', '/', rawurlencode($canonical_uri));
// Specify the hostname for the S3 endpoint
if($AWSRegion == 'us-east-1') {
@Vijaysinh
Vijaysinh / s3link-v4.php
Created August 6, 2021 07:15 — forked from kelvinmo/s3link-v4.php
PHP code to generate a pre-signed URL to access a restricted AWS S3 object
@Vijaysinh
Vijaysinh / gdn-placement-analysis
Created March 8, 2021 06:22 — forked from derekmartinla/gdn-placement-analysis
Find Underperforming Placements & Opportunities On Google Display Network
// This script reviews your GDN placements for the following conditions:
// 1) Placements that are converting at less than $40
// 2) Placements that have cost more than $50 but haven't converted
// 3) Placements that have more than 5K impressions and less than .10 CTR
function main() {
var body = "<h2>Google Display Network Alert</h2>";
body += "<h3>Placements that are converting at less than $40:</h3> " ;
body += "<ul>";
@Vijaysinh
Vijaysinh / shapeArea.js
Last active December 3, 2020 08:58 — forked from nick3499/shapeArea.js
CodeFights: shapeArea(n) Challenge
// https://nick3499.medium.com/codefights-shape-area-challenge-3319d3e6dc62
function shapeArea(n) {
init = 1;
return init + (n * ((n - 1) * 2));
}
console.log(shapeArea(4));
@Vijaysinh
Vijaysinh / adjacentElementsProduct
Created December 3, 2020 08:54 — forked from stahnni/adjacentElementsProduct
adjacentElementsProduct from codefights
/*
Given an array of integers, find the pair of adjacent elements that has the largest product and return that product.
Example
For inputArray = [3, 6, -2, -5, 7, 3], the output should be
adjacentElementsProduct(inputArray) = 21.
7 and 3 produce the largest product.
@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