Skip to content

Instantly share code, notes, and snippets.

View sagarbaver's full-sized avatar
:octocat:

Sagar Baver sagarbaver

:octocat:
View GitHub Profile
Making external embeds play well with our content
How we handle fb/twitter/youtube/<insert-a-website-here> embedding in our content to make them play well with the styling of our website.
Being a news website, we frequently cite and embed external content mostly Youtube, Twitter and sometimes Facebook. All of these websites provide their embed codes which is fairly easy to use in the sense that you can quickly copy the embed code and paste it in your CMS’s (traditionally Wordpress) HTML editor.
Here is an example of some common embed codes for various websites —
Problem with pasting embed codes directly is -
They eat a lot of user bandwidth with their script and content downloads.
The download size increases a lot more if there are multiple embeds in a single post.
Embeds like Youtube and Facebook videos even start downloading their initial video files too, even if users have not yet actually played the video.
@sagarbaver
sagarbaver / .vimrc
Created April 10, 2017 09:20 — forked from gosukiwi/.vimrc
.vimrc
" ---------------------- USABILITY CONFIGURATION ----------------------
" Basic and pretty much needed settings to provide a solid base for
" source code editting
" don't make vim compatible with vi
set nocompatible
" turn on syntax highlighting
syntax on
" and show line numbers
@sagarbaver
sagarbaver / stack_findMin.txt
Created March 10, 2017 05:48
Minimum element in a stack
minElem
While pushing x
if x < minElem
push 2*x - minElem // bcoz its always going to be lesser than x
update minElem to x
else push x
While popping x
if x < minElem
update minElem to be 2*minElem -y // this gives next minimum