Skip to content

Instantly share code, notes, and snippets.

View fokosun's full-sized avatar
🏠
Working from home

fokosun fokosun

🏠
Working from home
View GitHub Profile
@fokosun
fokosun / tymon-jwt-lumen5.4
Created July 24, 2017 14:23
How to install and configure tymon-jwt on Lumen5.4
pull in the package using composer
$ composer require tymon/jwt-auth:"^1.0@dev"
next run composer update
$ composer update
open AppServiceProvder and add the following code into the register method
you accidentally committed .idea and all it's gabbage, fix things by runnig the following on your terminal:
git rm --cached -r .idea
But first make sure add .idea to your .gitignore file like so:
.idea/*
commit then push!
<?php
//http://stackoverflow.com/questions/470617/get-current-date-and-time-in-php
//code below is from stackoverflow
$now = new DateTime();
echo $now->format('Y-m-d H:i:s'); // MySQL datetime format
echo $now->getTimestamp(); // Unix Timestamp
$now = new DateTime(null, new DateTimeZone('America/New_York'));
@fokosun
fokosun / instagram_scrape.php
Created April 21, 2016 17:25 — forked from cosmocatalano/instagram_scrape.php
Quick-and-dirty Instagram web scrape, just in case you don't think you should have to make your users log in to deliver them public photos.
<?php
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('http://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}
@fokosun
fokosun / gist:ede2986a2912010ec8fff429b94ca3f2
Created April 18, 2016 15:44 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

##git rebase

is actually pretty neat and easy and now i wonder why on earth i have been rebasephobia!

If you were like me (lol), this might change your mind, you will love it absolutely!

git rebase staging/master

//rebase against the branch you normally would commit to

@fokosun
fokosun / amendoldercommitmessage
Created December 20, 2015 20:26
If your commit is not the most recent one
git rebase -- interactive $parent_of_flawed_commit
An editor will come up, with a list of all commits since the one you gave. Change the commit anyway you like now:
git commit --amend
git rebase --continue
git rebase --interactive lets you correct commits no matter how long ago they were.
@fokosun
fokosun / amendrecentcommitmsg
Created December 20, 2015 20:19
Amend most recent commit message
git commit --amend -m "your new message"
Two branches diverged in a project on Git,
And sorry I could not push to both
And be one designer, long I sit
And analyzed one as best as I could
Through the tangled CSS undergrowth;
Then took the other, as just as fair,
And having perhaps the better claim,
Because the styling was basic and bare;
Though having been cloned the developer there
Had built them really about the same,
out in the hall the lights blink
as i try to think what the spec said again
it’s been too long since i felt warm and steady
since i felt i was ready to complete this task
no sweet lament to this sad omission
this terminal condition of uncertainty
be i hooked into circuitous solutions
or ugly convolutions from forum posts