Skip to content

Instantly share code, notes, and snippets.

View bih's full-sized avatar
😄

Bilawal Hameed bih

😄
View GitHub Profile
@bih
bih / app.ts
Last active March 28, 2019 10:08
Spotify Authentication with React Hooks
import React, { ReactNode } from 'react'
import { useSpotifyAccessTokenFromAuthCode, useSpotifyAccessTokenFromRefreshToken } from './hooks'
// Store them as environment variables!
//
const clientId = process.env.SPOTIFY_CLIENT_ID
const clientSecret = process.env.SPOTIFY_CLIENT_SECRET
const redirectUri = process.env.SPOTIFY_REDIRECT_URI
const clientPayload = { clientId, clientSecret, redirectUri }
@bih
bih / AppDelegate.swift
Last active March 21, 2024 14:28
iOS SDK Quick Start
//
// AppDelegate.swift
// iOS SDK Quick Start
//
// Created by Spotify on 14/06/2018.
// Copyright © 2018 Spotify for Developers. All rights reserved.
//
import UIKit
@bih
bih / long.js
Last active June 24, 2017 14:43
Calculate Your Age
(function(date_of_birth, decimal_points){
var date_today = Date.now()
, date_born = Date.parse(date_of_birth)
, difference = date_today - date_born;
var divided_to_seconds = difference / 1000
, divided_to_minutes = divided_to_seconds / 60
, divided_to_hours = divided_to_minutes / 60
, divided_to_days = divided_to_hours / 24
, divided_to_years = divided_to_days / 365;
@bih
bih / README.md
Last active April 1, 2017 15:30
Intro to Rails 5 Workshop

Intro to Rails 5 Workshop

0. Configuration

Ruby 2.4.0 & Rails 5.2.0

How to install Ruby 2.4.0

$ curl -sSL https://get.rvm.io | bash -s stable --ruby=2.4.0
@bih
bih / list.txt
Created February 23, 2017 21:57
MLH Season List
https://mlh.io/seasons/f2013/events
https://mlh.io/seasons/s2014/events
https://mlh.io/seasons/f2014/events
https://mlh.io/seasons/f2014-uk/events
https://mlh.io/seasons/s2015/events
https://mlh.io/seasons/2015-eu/events
https://mlh.io/seasons/f2015/events
https://mlh.io/seasons/f2015-eu/events
https://mlh.io/seasons/s2016/events
https://mlh.io/seasons/s2016-eu/events
@bih
bih / README.md
Last active November 10, 2018 22:52
Building API's with Jekyll

Building API's in Jekyll

This is part of a blog post series that I'm writing called Advanced Jekyll which you can find on [my website, bilaw.al][site].

You can read the blog post [Building API's in Jekyll by clicking here][post].

Installation

All the code in this gist is what I use to build API's with in Jekyll.

@bih
bih / README.md
Last active January 18, 2024 01:13
United In-Flight Wi-Fi JSON

United In-Flight Wi-Fi JSON

This is a small script I wrote that allows you to parse information of your flight when connected to United's In-Flight Wi-Fi. It provides information such as expected/actual departure, arrivals, airports, temperatures, altitude, ground speed, miles accrued for the flight and the flight number.

Install

Copy united.rb to your computer and install the following gems:

$ gem install httparty
@bih
bih / embed_in_console.js
Last active January 3, 2016 17:00
Calculate how much you've paid to Spotify
// Go to https://www.spotify.com/account/subscription/receipt/
var Receipt = function(jquery){
this.id = $(jquery).find(".receipt-orderid").text();
this.id = $.trim(this.id);
this.id = parseInt(this.id);
this.date = $(jquery).find(".receipt-date").text();
this.date = new Date(Date.parse(this.date));
//
// BHSwipeButton.swift
// HelloHub
//
// Created by Bilawal Hameed on 09/08/2015.
// Copyright (c) 2015 HelloHub. All rights reserved.
//
import Foundation
import UIKit
@bih
bih / jquery.matchHeightWith.js
Last active August 29, 2015 14:22
jQuery.matchHeightWith.js - Match two divs heights together.
/**
* jQuery function to match two div heights. Disables for mobiles so the experience is better.
*/
$.fn.matchHeightWith = function(jqSelector) {
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
return;
}
var match_a = $(this).height();