Skip to content

Instantly share code, notes, and snippets.

View aalaap's full-sized avatar
🎯
Focusing

Aalaap Ghag aalaap

🎯
Focusing
View GitHub Profile
@aalaap
aalaap / strdoge.cpp
Last active August 29, 2015 13:56
strdoge(): inspired by strcat(). such wow, much code.
#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);

Keybase proof

I hereby claim:

  • I am aalaap on github.
  • I am aalaap (https://keybase.io/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
aalaap / desopafy.html
Created January 18, 2012 08:24 — forked from timraymond/desopafy.js
Remove SOPA overlay from Wikipedia pages via a bookmarklet
<a href="javascript:(function(){$('body>div').toggle();})();">DeSOPAFy</a>
@aalaap
aalaap / fn.quickYouTubeId.php
Last active February 5, 2019 10:55
Easy little function to get the video ID from any YouTube URL.
<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
aalaap / flaskserver.py
Created February 5, 2019 11:04
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.
Usage:
python flaskserver.py dev # runs with debug set to True
python flaskserver.py # production mode
@aalaap
aalaap / gist:3066704
Created July 7, 2012 14:39
Sample HTML page with Twitter's Bootstrap, Ryan Fait's Sticky Footer, and a full-width footer, fixed for responsive layouts by Aalaap Ghag
<!DOCTYPE html>
<html>
<head>
<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">
<style>
html, body {
@aalaap
aalaap / fn.StripTagsOnly.php
Last active April 14, 2022 12:42
Strip Tags Only - An implemention of the PHP strip_tags function that only removes specified tags
<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']).
@aalaap
aalaap / App.js
Last active January 29, 2023 12:06
Creating a custom authentication flow from scratch with AWS Amplify and React - sample code
/**
* This code is based on Nader Dabit's tutorial for custom Cognito authentication
* using AWS Amplify and React: https://www.youtube.com/watch?v=JaVu-sS3ixg&t=24s
*
* 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";