Skip to content

Instantly share code, notes, and snippets.

View Raja0sama's full-sized avatar
😍
CODING DAY NIGHT

Raja Osama Raja0sama

😍
CODING DAY NIGHT
View GitHub Profile
@Raja0sama
Raja0sama / data.json
Created August 22, 2022 12:55
Sample Car Data
[
{
"year": "2022",
"make": "honda",
"model": "civic",
"style": "401875382",
"url": "https://www.edmunds.com/car-maintenance/results.html?styleId=401875382&mileage=40000",
"styleModel": "LX 4dr Sedan (2.0L 4cyl CVT)",
"data": {
"makes": [{ "id": "200001444" }],
@Raja0sama
Raja0sama / index.java
Created March 15, 2022 12:22
I am stuck
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class App {
// Number of neurons in the input layer
private static final int INPUT_NEURONS = 4;
private static final int INPUTS_LENGTH = 64;
@Raja0sama
Raja0sama / loadMore.js
Created June 17, 2021 12:04
Load more feature for any HTML element containing multiple childnodes.
let init = (el) => {
var container = document.getElementsByClassName(el)
let list = container[0].children
const defEl = 2
let def = defEl
Array.from(list).forEach(e => e.style.display = "none")
return () => {
let a = false
Array.from(list).forEach((e, i) => {
console.log({ i, def })
import React, { useState } from 'react';
import styles from './index.less';
import { Form, Input, Button, Checkbox } from 'antd';
import { UserOutlined, LockOutlined } from '@ant-design/icons';
import { useIntl, connect, FormattedMessage } from 'umi';
import { Login as Log } from '@/models/user';
const LoginMessage = ({ content }) => (
<Alert
style={{
@Raja0sama
Raja0sama / user.js
Created May 18, 2021 21:26
DVA Redux
import Auth from '@/services/auth';
import { queryCurrent, query as queryUsers } from '@/services/user';
import Firestore from '@/services/firestore';
import { refs, functions, auth, db } from '@/services/utils/firebase_config';
import { getAuthority, removeAuthority, setAuthority } from '@/utils/authority';
import { dispatch, RANDOMWORDS, redirectWhenLoggedIn, replacerFunc } from '@/utils/utils';
import { message } from 'antd';
import axios from 'axios';
import { loadAlerts } from '@/.umi/plugin-dva/connect';
import { history } from 'umi';
@Raja0sama
Raja0sama / server.js
Created May 1, 2021 15:28
Next Js Express Custom server
const express = require("express");
const next = require("next");
const port = process.env.PORT || 3000;
const dev = true;
const app = next({ dev });
const handle = app.getRequestHandler();
app
.prepare()
@Raja0sama
Raja0sama / utils.js
Created March 19, 2021 12:54
Accessing App Reference in UMI for the store.
// import
import { getDvaApp } from 'umi'
// DVA store.
const store = getDvaApp()?._store
// function, this is how you can access dispatch
export function dispatch(action) {
return getDvaApp()?._store.dispatch(action);
}
@Raja0sama
Raja0sama / index.css
Created February 12, 2021 06:35
splash screen css 2
:root {
--color: #1c1821;
}
.Splash {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
@Raja0sama
Raja0sama / index.js
Created February 12, 2021 06:35
Splash Screen text 2
import logo from "./logo.svg";
import "./App.css";
import { useEffect, useRef, useState } from "react";
function App() {
const [state, setstate] = useState(40);
useEffect(() => {}, []);
return (
<div className="Splash">
@Raja0sama
Raja0sama / index.js
Created February 12, 2021 06:06
Splash Screen
import logo from "./logo.svg";
import "./App.css";
import { useEffect, useRef, useState } from "react";
function App() {
const [state, setstate] = useState(40);
const dot1 = useRef();
const dot2 = useRef();
const dot3 = useRef();
const container = useRef();