Skip to content

Instantly share code, notes, and snippets.


Aalaap Ghag aalaap

View GitHub Profile
aalaap / App.js
Last active May 28, 2021
Creating a custom authentication flow from scratch with AWS Amplify and React - sample code
View App.js
* This code is based on Nader Dabit's tutorial for custom Cognito authentication
* using AWS Amplify and React:
* It's 99% the same as the video, but I've sprinkled a few niceties here and there.
import React, { useEffect, useState } from "react";
import Amplify, { Auth, Hub } from "aws-amplify";
aalaap /
Created Feb 5, 2019
Run a Flask app in production or development/debug from the command line
Run a Flask app in production or development/debug from the command line
If you wish to run a Flask app with Python instead of the `flask run` command,
this code provides an easier way to decide if you want to run it in production
or debug mode.
python dev # runs with debug set to True
python # production mode
aalaap / fn.StripTagsOnly.php
Last active Jul 6, 2018
Strip Tags Only - An implemention of the PHP strip_tags function that only removes specified tags
View fn.StripTagsOnly.php
* Strip Tags Only
* Just like strip_tags, but only removes the HTML tags specified and not all of
* them.
* @param String $text The text to strip the tags from.
* @param String|Array $allowedTags This can either be one tag (eg. 'p') or an
* array, (eg. ['p','br','h1']).

Keybase proof

I hereby claim:

  • I am aalaap on github.
  • I am aalaap ( on keybase.
  • I have a public key whose fingerprint is F267 4132 B0A1 3A35 2D5F ECDE 2968 DF2C 0D0F 5E20

To claim this, I am signing this object:

aalaap / strdoge.cpp
Last active Aug 29, 2015
strdoge(): inspired by strcat(). such wow, much code.
View strdoge.cpp
#include <iostream>
#include <sstream>
using namespace std;
/* supply words and strdoge() will echo the doge and strdog() will return the doge */
string strdog(string so, string such, string very, string much);
void strdoge(string so, string such, string very, string much);
aalaap / fn.quickYouTubeId.php
Last active Feb 5, 2019
Easy little function to get the video ID from any YouTube URL.
View fn.quickYouTubeId.php
* quickYouTubeId: Easy little function to get the video ID from any YouTube
* URL.
* I went through a lot of snippets that perform various kinds of RegEx and
* parse_url and what not, but I thought, since most YouTube video IDs are 11
* characters, why not just look for the only 11-character string and extract
* that? I can't think of a YouTube URL that'll foil this match. Can you?
aalaap / gist:3066704
Created Jul 7, 2012
Sample HTML page with Twitter's Bootstrap, Ryan Fait's Sticky Footer, and a full-width footer, fixed for responsive layouts by Aalaap Ghag
View gist:3066704
<!DOCTYPE html>
<meta charset="utf-8" />
<meta name="author" content="Aalaap Ghag" />
<title>Twitter&rsquo;s Bootstrap with Ryan Fait&rsquo;s Sticky Footer and Aalaap Ghag&rsquo;s Responsive Padding Fix</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link href="css/bootstrap-responsive.css" rel="stylesheet">
html, body {
aalaap / desopafy.html
Created Jan 18, 2012 — forked from timraymond/desopafy.js
Remove SOPA overlay from Wikipedia pages via a bookmarklet
View desopafy.html
<a href="javascript:(function(){$('body>div').toggle();})();">DeSOPAFy</a>