Skip to content

Instantly share code, notes, and snippets.

View aibrahim3546's full-sized avatar

ibrahim aibrahim3546

View GitHub Profile
@aibrahim3546
aibrahim3546 / CountryCodes.json
Created January 5, 2022 15:11 — forked from anubhavshrimal/CountryCodes.json
Country and Dial or Phone codes in JSON format
[
{
"name": "Afghanistan",
"dial_code": "+93",
"code": "AF"
},
{
"name": "Aland Islands",
"dial_code": "+358",
"code": "AX"
@aibrahim3546
aibrahim3546 / decodeQRCodeFromImageReactNative.js
Created May 7, 2020 10:05
Decode QR code from image in react native
import jsQR from 'jsqr' // required package
import Jimp from 'jimp' // required package
const BASE64_MARKER = ';base64,'
const base64ToArrayBuffer = (dataURI) => {
const base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length
const base64 = dataURI.substring(base64Index)
const binaryString = window.atob(base64)
const len = binaryString.length
@aibrahim3546
aibrahim3546 / customCalendar.js
Created May 4, 2020 13:52
Gist containing code for creating custom calendar in react using hooks.
import React, { useState, useEffect } from 'react';
import styled from 'styled-components'
const { datesGenerator } = require('dates-generator');
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
const Container = styled.div`
width: 300px;
border: 1px solid black;
@aibrahim3546
aibrahim3546 / calendarDates.js
Last active October 5, 2022 17:12
javascript code to generate calendar. By using this you can create your own customized calendar UI.
const daysInMonth = (iYear, iMonth) => 32 - new Date(iYear, iMonth, 32).getDate()
const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
const getSelectedMonthDates = (selectedYear, selectedMonth) => {
const calendarDates = []
const firstDay = (new Date(selectedYear, selectedMonth)).getDay() // 0 = 'Sunday', 6 = 'Saturday'
const days = daysInMonth(selectedYear, selectedMonth) // how many days in a month
let x = 0