Skip to content

Instantly share code, notes, and snippets.

View v1shwa's full-sized avatar
:octocat:
⚡️

Vishwa v1shwa

:octocat:
⚡️
View GitHub Profile
@v1shwa
v1shwa / pushapi.php
Last active December 20, 2015 00:09
Simple Txtweb Push API Example.
<?php
function txtweb_push($app_key,$pub_key,$mobile_hash,$message) {
//setup message
$message = trim($message);
$message = urlencode("<html><head><meta name=\"txtweb-appkey\" content=\"$app_key\" /></head>
<body>$message</body></html>");
//Set parameters for post request
$fields = "txtweb-message=$message&txtweb-pubkey=$pub_key&txtweb-mobile=$mobile_hash";
@v1shwa
v1shwa / v1shwa
Created January 27, 2015 05:02
Hello
Hi
@v1shwa
v1shwa / mashape.php
Created October 3, 2015 04:31
Easiest Way to use Mashape API using PHP
<?php
// Config //
// URL
$url = "https://playstore-v1.p.mashape.com/app/details?appid=com.whatsapp&lang=en";
// request timeout in seconds
$timeout = 10;
// Custom headers. X-Mashape-Key is mandatory, you can add more if you want
$headers = array(
"X-Mashape-Key: zLqjY8Vh5smshYxxxxxxxxxxxxxxxxxxxxtjsnxiwdKfOmYs9g",
"Accept: application/json"
@v1shwa
v1shwa / apache-permission.sh
Last active October 28, 2023 08:03
Ubuntu: Fix for Permissions denied on /var/www/html
# 1. Change owner of /var/www/html directory to apache user, here: www-data
sudo chown -R www-data:www-data /var/www/html
# 2. Allow Group to edit
sudo chmod -R 775 /var/www/html
# 3. Add yourself to apache group(www-data)
sudo usermod -a -G www-data ${USER}
@v1shwa
v1shwa / aes.php
Created November 23, 2015 17:56
AES256 CBC Encryption with PKCS7 Padding in PHP
<?php
function aes256_cbc($data, $key, $iv)
{
// padding
$blocksize = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128,'cbc');
$len = strlen($data);
$pad = $blocksize - ($len % $blocksize);
$data .= str_repeat(chr($pad), $pad);
// encrypting & encoding
return base64_encode( mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC, $iv) ) ;
@v1shwa
v1shwa / ios-genres.md
Created December 1, 2015 12:25
IOS App Store - Genre Codes

IOS App Store - Genre Codes

Name Code
Nonfiction 9002
Romance 9003
Travel & Adventure 9004
Arts & Entertainment 9007
Biographies & Memoirs 9008
@v1shwa
v1shwa / ios-apps-genres.md
Created December 1, 2015 14:36
Ios Apps Genres Codes

IOS App Store - Genre Codes

Name Code
ALL 0 (or blank)
Business 6000
Weather 6001
Utilities 6002
Travel 6003
@v1shwa
v1shwa / pecl-oauth.sh
Created December 3, 2015 04:52
Installing PHP OAuth in Ubuntu
# Steps for installing PECL oAuth package on ubuntu
apt-get update
apt-get install libpcre3 libpcre3-dev php5-dev
pecl install -Z oauth
@v1shwa
v1shwa / PHP - excel to array helper function.php
Last active December 5, 2015 11:54 — forked from calvinchoy/PHP - excel to array helper function.php
PHP - excel to array helper function
<?php
/*
|--------------------------------------------------------------------------
| Excel To Array
|--------------------------------------------------------------------------
| Helper function to convert excel sheet to key value array
| Input: path to excel file, set wether excel first row are headers
| Dependencies: PHPExcel.php include needed
*/
function excelToArray($filePath, $header=true){
@v1shwa
v1shwa / QB-tax-invoice.php
Created February 12, 2016 14:08
Quickbooks Invoice with Tax using Consolibyte's SDK
<?php
$InvoiceService = new QuickBooks_IPP_Service_Invoice();
$Invoice = new QuickBooks_IPP_Object_Invoice();
$Invoice->setDocNumber('st-100002'); // doc number (optional)
$Invoice->setTxnDate('2016-02-12');
$Invoice->setCustomerRef( 1 ); // customer Id
// Create a New line