Skip to content

Instantly share code, notes, and snippets.

View bih's full-sized avatar
😄

Bilawal Hameed bih

😄
View GitHub Profile
@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 / 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 / apple-university-stores.json
Last active November 19, 2023 22:36
List of Apple's UK university education stores w/ web addresses
[{"region":"East Midlands","university":"De Montfort University","url":"http://store.apple.com/uk_edu_5000657"},{"region":"East Midlands","university":"Derby University","url":"http://store.apple.com/uk_edu_5000659"},{"region":"East Midlands","university":"Jisc Collections and Janet Limited","url":"http://store.apple.com/uk_edu_5004321"},{"region":"East Midlands","university":"Leicester University","url":"http://store.apple.com/uk_edu_5000710"},{"region":"East Midlands","university":"Lincoln University","url":"http://store.apple.com/uk_edu_5000712"},{"region":"East Midlands","university":"Loughborough College","url":"http://store.apple.com/uk_edu_5000723"},{"region":"East Midlands","university":"Loughborough University","url":"http://store.apple.com/uk_edu_5002639"},{"region":"East Midlands","university":"Nottingham Trent University","url":"http://store.apple.com/uk_edu_5000747"},{"region":"East Midlands","university":"Nottingham University","url":"http://store.apple.com/uk_edu_5000748"},{"region":"East Midla
@bih
bih / MergeSort.markdown
Last active December 31, 2022 14:20
MergeSort Example in Ruby

MergeSort Algorithm in Ruby

When learning about sorting algorithms, I wanted to implement them to help me understand them better. This algorithm was originally invented by John von Neumann in 1948.

The Ruby script attached explains in real code what is going on. Play about with it.

How does the algorithm work?

Step by step:

  • Pass through an array of unsorted numbers (i.e. [4, 3, 2, 10])
@bih
bih / iphone.rb
Last active June 6, 2022 12:39
Get all of your iPhone data via USB (relies on libimobiledevice - https://github.com/libimobiledevice/libimobiledevice)
require "json"
class IOS
def self.get
q = `ideviceinfo`
IOS.new(q.split("\n").map{ |item| k, v = item.split(": ", 2); { k.strip.to_sym => v.strip }})
rescue
nil
end
@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 / 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 / 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