Skip to content

Instantly share code, notes, and snippets.

View yokesharun's full-sized avatar
😬
Happy

Arun Yokesh yokesharun

😬
Happy
View GitHub Profile
@yokesharun
yokesharun / android_screen_size_list.md
Last active March 17, 2016 11:10
Android Icons and splash screen Sets Size - PhoneGap

Application icon size list

36x36 -- ldpi

48x48 -- mdpi

72x72 -- hdpi

96x96 -- xhdpi

@yokesharun
yokesharun / tmux-cheatsheet.markdown
Last active April 1, 2016 14:10 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@yokesharun
yokesharun / List.md
Created July 29, 2016 16:16 — forked from msurguy/List.md
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

@yokesharun
yokesharun / notes.md
Last active August 11, 2016 07:07
API Token Authentication in Laravel 5.2

I recently had the need to write a small url shortening application. I am aware that this problem has been solved quite a few times before, but what is being a developer if not reinventing the wheel just for the heck of it? Custom CMS anyone?

Knowing that this was going to be a tiny RESTful API and also knowing that Laravel 5.2 had API rate limiting built in, I was eager to give it a try. Taylor Otwell being Taylor Otwell shipped 5.2 with the rate limiting defaults set up out of the box and I had my application building out short url's in a matter of minutes. The problem for me came when I wanted to start associating those short urls with a user.

Typically my applications have a UI and authentication is done through a simple login page. Obviously for a RESTful API, having a login page isn't ideal. Instead, my hope was to have users append an api_token to the end of their query string and use that to authenticate their request. I was happy to find that 5.2 also ships with a TokenGuard(link) class that allows

@yokesharun
yokesharun / swift.md
Created September 27, 2016 13:12
Awesome Swift iOS Full Detailed libraries list
@yokesharun
yokesharun / file.php
Created March 2, 2017 13:39
Get Hour difference between two dates
$hourdiff = round((strtotime($time1) - strtotime($time2))/3600, 1);
echo $hourdiff;
@yokesharun
yokesharun / find_distance.php
Last active March 20, 2017 09:57
Find the Distance between two latitude and longitude points
function haversineGreatCircleDistance(
$latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo, $earthRadius = 6371000)
{
// convert from degrees to radians
$latFrom = deg2rad($latitudeFrom);
$lonFrom = deg2rad($longitudeFrom);
$latTo = deg2rad($latitudeTo);
$lonTo = deg2rad($longitudeTo);
$latDelta = $latTo - $latFrom;
@yokesharun
yokesharun / Blockstack.txt
Created December 6, 2017 06:57
Blockstack ID
Verifying my Blockstack ID is secured with the address 1F2BFT4XPMyUJ4wzNNnk2717a3nVZQch32 https://explorer.blockstack.org/address/1F2BFT4XPMyUJ4wzNNnk2717a3nVZQch32
@yokesharun
yokesharun / get_ip_address.js
Created February 8, 2016 13:30
Get your ip with Jquery
$.get("http://ipinfo.io", function(response) {
alert(response.ip);
}, "jsonp");
@yokesharun
yokesharun / React-State-Props-Manipulation.js
Created July 6, 2018 17:14
React State and props Initialisation and manupulation
// Define a state
this.state = {
name: "Jon Snow",
age: 28
}
// get value of the state
this.state.name