Skip to content

Instantly share code, notes, and snippets.

View Kokil's full-sized avatar
🙃

Kokil Kokil

🙃
View GitHub Profile
@Kokil
Kokil / Response.php
Created April 26, 2020 05:28 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@Kokil
Kokil / .htaccess
Created June 18, 2019 06:43 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@Kokil
Kokil / !NOTE.md
Created July 15, 2018 10:23 — forked from ivanvermeyen/!NOTE.md
Setup a Laravel Storage driver with Google Drive API
@Kokil
Kokil / GoogleDriveServiceProvider.php
Created July 12, 2018 18:24 — forked from sergomet/GoogleDriveServiceProvider.php
Setup a Laravel Storage driver with Google Drive API
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class GoogleDriveServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
@Kokil
Kokil / haversine.php
Created December 25, 2017 07:10 — forked from fhferreira/haversine.php
Haversine Method for model Laravel.
<?php
/*
* find the n closest locations
* @param Model $query eloquent model
* @param float $lat latitude of the point of interest
* @param float $lng longitude of the point of interest
* @param float $max_distance distance in miles or km
* @param string $units miles or kilometers
* @param Array $fiels to return
* @return array
@Kokil
Kokil / kannel.conf
Created October 10, 2017 05:48 — forked from tobiasmcnulty/kannel.conf
Sample Kannel configuration for talking to RapidSMS server
#
# CONFIGURATION FOR USING SMS KANNEL WITH RAPIDSMS
#
# For any modifications to this file, see Kannel User Guide
# If that does not help, see Kannel web page (http://www.kannel.org) and
# various online help and mailing list archives
#
# Notes on those who base their configuration on this:
# 1) check security issues! (allowed IPs, passwords and ports)
# 2) groups cannot have empty rows inside them!
@Kokil
Kokil / RestControllerTrait.php
Created October 9, 2017 08:56 — forked from dmgallardo/RestControllerTrait.php
Playing with Laravel Lumen: simple RESTful trait.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
trait RestControllerTrait {
/**
* Manage index request
@Kokil
Kokil / wp.sh
Created September 21, 2017 11:06 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@Kokil
Kokil / wp.sh
Created September 21, 2017 11:06 — forked from phlbnks/wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Do you need to setup new MySQL database? (y/n)"
read -e setupmysql
if [ "$setupmysql" == y ] ; then
echo "MySQL Admin User: "
read -e mysqluser
@Kokil
Kokil / php-webscraping.md
Created April 10, 2017 17:00 — forked from anchetaWern/php-webscraping.md
web scraping in php

Have you ever wanted to get a specific data from another website but there's no API available for it? That's where Web Scraping comes in, if the data is not made available by the website we can just scrape it from the website itself.

But before we dive in let us first define what web scraping is. According to Wikipedia:

{% blockquote %} Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. {% endblockquote %}