Skip to content

Instantly share code, notes, and snippets.

View safaldas's full-sized avatar
🎯
Focusing

Safaldas G safaldas

🎯
Focusing
View GitHub Profile
import React, { Component } from "react";
import { firebaseInit } from "../db/firestore.init";
const UserContext = React.createContext({});
export const UserConsumer = UserContext.Consumer;
export default UserContext;
var db = firebaseInit();
export class UserProvider extends Component {
state = {
import React, { Component } from "react";
import { firebaseInit } from "../db/firestore.init";
const UserContext = React.createContext({});
export const UserConsumer = UserContext.Consumer;
export default UserContext;
var db = firebaseInit();
export class UserProvider extends Component {
state = {
@safaldas
safaldas / timeDifference.js
Last active December 13, 2019 12:09
A time ago util copied from the appolo docs for reference
function timeDifference(current, previous) {
const milliSecondsPerMinute = 60 * 1000
const milliSecondsPerHour = milliSecondsPerMinute * 60
const milliSecondsPerDay = milliSecondsPerHour * 24
const milliSecondsPerMonth = milliSecondsPerDay * 30
const milliSecondsPerYear = milliSecondsPerDay * 365
const elapsed = current - previous
if (elapsed < milliSecondsPerMinute / 3) {
@safaldas
safaldas / convertStringToHEX.js
Last active June 27, 2019 05:20
text to hexadecimal convert in js javascript
function convertStringToHEX(d) {
let f = '';
d.split('').forEach((s, i) => {
let hexCode = '000'+s.charCodeAt(0).toString(16);
f = f +'0x'+ hexCode.substring(hexCode.length-4) + ' ';
});
return f;
}
@safaldas
safaldas / CONTRIBUTING.md
Created May 7, 2018 04:55
this will be areference of contributer guideline

Contribution Guideline

Welcome to early draft of how to contribute to this repository. This guide broadly outlines on how to contribute to the repo.

  • Clone the repo (Only if you havent done so before !)
  • Pull the latest changes to main devleopment branch and checkout a new branch for working on the feature, bug etc
  • Do whatever you were planning to do. Follow the style guide and add test cases if necessary
  • Commit the changes . Follow commit message guidelines
  • Push the new branch to repo and make a PR and assign it to someone. follow PR guideline
  • After the code is reviewed and if its ready to go, merge and delete the branch.
@safaldas
safaldas / README-Template.md
Created November 3, 2017 05:06 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@safaldas
safaldas / vscodesettingsprettier
Created June 7, 2017 10:10
vscode prettier settings
{
"prettier.semi": false,
"prettier.singleQuote": true,
"prettier.jsxBracketSameLine": false,
"prettier.printWidth": 100
}
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash
sudo apt-get install -y nodejs
gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshe$
gsettings set com.canonical.Unity.Launcher launcher-position Bottom
sudo apt-get install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/ma$
sudo apt-get install git
sudo npm install http-server -g
sudo apt-get install mongodb
@safaldas
safaldas / note.txt
Created January 21, 2017 13:16
Simple questions to ask for each unit test
The best way to write high quality unit tests is to write the test with these questions in mind:
What are you testing?
What should the code you’re testing do?
What is the actual output of the code under test?
What is the expected output of the code under test?
If you answer all of those questions, you’ll find you quickly have a higher quality unit test suite with high code