Skip to content

Instantly share code, notes, and snippets.

View rammyblog's full-sized avatar

Babatunde Onasanya rammyblog

View GitHub Profile
<?php
$urls = array(
'https://www.google.com',
'https://www.twitter.com',
'https://www.rammyblog.com.ng',
'http://www.dropbox.com',
);
$multi = curl_multi_init();
$channels = array();
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="author" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
body{
background: #E5E5E5;
}
.wrapper{
min-height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
import React, { Component } from 'react';
import axios from 'axios';
const GlobalContext = React.createContext();
GlobalContext.displayName = "Context Setup";
class GlobalProvider extends Component {
state = {
data: []
@rammyblog
rammyblog / py_gravatar.py
Last active May 15, 2020 21:51
Gravatar Python3 Image Requests (Get Gravatar Image URL using user email)
import hashlib
import requests
def get_gravatar_image_url(email):
# Set your variables here
default = "https://res.cloudinary.com/rammy/image/upload/ar_4:3,c_fill/c_scale,w_auto,dpr_auto/v1589578218/default_avatar.png"
size = 200
base_url = "https://www.gravatar.com/avatar/"
import { createContext } from "react"
import priceTrackerApi from "../../api/apiUtils"
const initalTrackerState = {
loading: false,
data: null,
error: false,
errResponse: null,
}
@rammyblog
rammyblog / Local PR test and merge.md
Created August 10, 2021 09:20 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@rammyblog
rammyblog / TwoSum.js
Last active October 7, 2025 21:56
Two Sum Solution
/**
* https://leetcode.com/problems/two-sum/
* @param {number[]} nums
* @param {number} target
* @return {number[]}
*/
var twoSum = function(nums, target) {
const hash = {}
for(let i = 0; i<=nums.length; i++){
let current = nums[i] // 7
@rammyblog
rammyblog / containsDuplicate.js
Created October 7, 2025 22:07
Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
/**
* @param {number[]} nums
* @return {boolean}
* https://leetcode.com/problems/contains-duplicate/description/
*/
var containsDuplicate = function(nums) {
const hash = {}
for(let i = 0; i<=nums.length; i++){
let current = nums[i]
if(current in hash){
@rammyblog
rammyblog / groupAnagrams.js
Created October 7, 2025 23:34
Given an array of strings strs, group the anagrams together. You can return the answer in any order.
/**
* https://leetcode.com/problems/group-anagrams/
* @param {string[]} strs
* @return {string[][]}
*/
var groupAnagrams = function(strs) {
const ma = new Map()
const final = []
for(const word of strs){
let current = word