Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Bilawal Hameed bih

View GitHub Profile
@bih
bih / app.ts
Last active Mar 28, 2019
Spotify Authentication with React Hooks
View app.ts
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 Feb 14, 2019
iOS SDK Quick Start
View AppDelegate.swift
//
// 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 Jun 24, 2017
Calculate Your Age
View long.js
(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 Apr 1, 2017
Intro to Rails 5 Workshop
View README.md

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 Feb 23, 2017
MLH Season List
View list.txt
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 Nov 10, 2018
Building API's with Jekyll
View README.md

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 Jan 5, 2016
United In-Flight Wi-Fi JSON
View README.md

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 Jan 3, 2016
Calculate how much you've paid to Spotify
View embed_in_console.js
// 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));
View BHSwipeButton.swift
//
// 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 Aug 29, 2015
jQuery.matchHeightWith.js - Match two divs heights together.
View jquery.matchHeightWith.js
/**
* 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();
You can’t perform that action at this time.