Skip to content

Instantly share code, notes, and snippets.

@ICeZer0
ICeZer0 / TwosComplement.js
Created January 17, 2019 14:04
Takes a Binary string and will return its signed decimal value
function binaryTwosComplementToInt(binaryString) {
if (binaryString[0] != 1) {
return parseInt(binaryString, 2);
}
let twosComplementResult = "";
binaryString.match(/.{1,1}/g).forEach(str => {
twosComplementResult += (str == 1) ? str = 0 : str = 1;
});
@ICeZer0
ICeZer0 / HexToBinary.js
Created January 18, 2019 12:06
Converts 4 byte Hex to 32 bit binary string
function Hex32BitToBinary(HexData){
let result = "";
//32bit hex to string
HexData.match(/.{1,2}/g).forEach(str => {
result += hex2bin(str)
});
return result;
}

Keybase proof

I hereby claim:

  • I am icezer0 on github.
  • I am idurant (https://keybase.io/idurant) on keybase.
  • I have a public key ASCyDM4wqZMk1sMJPy6oTaLMhGJu5pip0_cykOK4JhQy6go

To claim this, I am signing this object:

@ICeZer0
ICeZer0 / handleSignUp.js
Created April 11, 2020 22:28
handleSignUp
import { validateAll } from 'indicative/validator';
const handleSignUp = () => {
const rules = {
email: 'required|email',
password: 'required|string|min:6|max:40|confirmed'
};
const data = {
email: emailAddress,
@ICeZer0
ICeZer0 / SignUpScreen.js
Created April 11, 2020 22:29
React-navigation
import React, { useEffect, useState, useContext } from 'react';
import { validateAll } from 'indicative/validator';
import { View, Text } from 'react-native';
import {
Input,
Card,
FormValidationMessage,
Button
} from 'react-native-elements';
import React, { useEffect, useState, useContext } from 'react';
import { validateAll } from 'indicative/validator';
import { View, Text } from 'react-native';
import {
Input,
Card,
FormValidationMessage,
Button
} from 'react-native-elements';
const authContextValue = useMemo(
() => ({
signIn: async data => {
if (
data &&
data.emailAddress !== undefined &&
data.password !== undefined
) {
dispatch({ type: 'SIGN_IN', token: 'Token-For-Now' });
} else {
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createDrawerNavigator, DrawerItems } from '@react-navigation/drawer';
const Stack = createStackNavigator();
const Drawer = createDrawerNavigator();
const createHomeStack = () => {
const { signOut } = useContext(AuthContext);
return (
<Stack.Navigator>
<Stack.Screen
name="Home Screen"
component={createDrawer}
initialParams={{ singOut: signOut }}
/>
@ICeZer0
ICeZer0 / web-dev-setup.md
Created September 9, 2020 01:39
Setting up a web development environment for your computer.. you'll want these