Skip to content

Instantly share code, notes, and snippets.

View fokosun's full-sized avatar
:octocat:
I may be slow to respond.

fokosun fokosun

:octocat:
I may be slow to respond.
View GitHub Profile
<?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
@fokosun
fokosun / rebasing-to-staging.txt
Last active September 21, 2015 13:17
How to rebase to staging to fix merge conflicts
git checkout staging
git pull origin staging
git status
git checkout <my branch name>
git merge staging
git add .
git status
git commit -m "my commit message"
git status
git push origin
<div class="tweet original-tweet js-stream-tweet js-actionable-tweet js-profile-popup-actionable js-original-tweet
" data-feedback-key="stream_status_374123416800206848" data-tweet-id="374123416800206848" data-item-id="374123416800206848" data-screen-name="dboudreau" data-name="Denis Boudreau " data-user-id="10096552" data-is-reply-to="true" data-has-parent-tweet="true" data-expanded-footer="&lt;div class=&quot;js-tweet-details-fixer tweet-details-fixer&quot;&gt;
&lt;div class=&quot;js-tweet-media-container &quot;&gt;&lt;/div&gt;&lt;div class=&quot;entities-media-container &quot; style=&quot;min-height:0px&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;js-machine-translated-tweet-container&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;js-tweet-stats-container tweet-stats-container &quot;&gt;
&lt;/div&gt;&lt;div class=&quot;client-and-actions&quot;&gt;
&lt;span class=&quot;metadata&quot;&gt;
&lt;span title=&quot;11:55 AM - 1 Sep 13&quot;&gt;11:55 AM - 1 Sep 13&lt;/span&gt;
&amp;middot; &lt;a class=&quot;permalink-lin