Skip to content

Instantly share code, notes, and snippets.

View AndreiF13's full-sized avatar

Andrei F. AndreiF13

View GitHub Profile
@AndreiF13
AndreiF13 / style.css
Created November 8, 2021 11:56 — forked from tomyshoam/style.css
style.css
.eui-item-text-see-more {
color: #9a9b9b;
line-height: 20px;
cursor: pointer;
transition: color 0.2s ease;
white-space: nowrap;
}
.eui-item-text-see-more:hover {
color: #17191a;
}
@AndreiF13
AndreiF13 / password.js
Created July 11, 2020 17:59 — forked from soplakanets/password.js
Password hashing for node.js
var crypto = require('crypto');
var SaltLength = 9;
function createHash(password) {
var salt = generateSalt(SaltLength);
var hash = md5(password + salt);
return salt + hash;
}
@AndreiF13
AndreiF13 / SSLXampp.md
Created June 8, 2020 06:08 — forked from nguyenanhtu/SSLXampp.md
Guide to configure SSL in XAMPP for Windows

How to test 'https' in XAMPP for localhost ? I will guide you

Menu

  • Create certificate
  • Config Apache to access https instead of http
  • Config mod rewrite to generate SSL url
  • Config Virtual host to test site

Step 1 : Create certificate

  • Go to your XAMPP installation directory (in my case it’s E:\xampp), figure out apache folder. In this, find & run batch file
keywords.select2({
tags: true,
createTag: function (params) {
var term = $.trim(params.term);
var count = 0
var existsVar = false;
//check if there is any option already
if($('#keywords option').length > 0){
$('#keywords option').each(function(){
if ($(this).text().toUpperCase() == term.toUpperCase()) {
@AndreiF13
AndreiF13 / findUser.js
Last active January 2, 2020 15:24 — forked from paigen11/findUser.js
Passport local and Passport JWT authentication with custom callbacks examples with a user registration MERN service.
import passport from 'passport';
module.exports = app => {
app.get('/findUser', (req, res, next) => {
passport.authenticate('jwt', { session: false }, (err, user, info) => {
if (err) {
console.log(err);
}
if (info != undefined) {
console.log(info.message);
@AndreiF13
AndreiF13 / __responsive styled components
Created December 17, 2019 21:08 — forked from granmoe/__responsive styled components
Programmatically create responsive styled components with react and styled-components
// this file is just here to change the name of the gist
import React from 'react'
import styled from 'styled-components'
const makeResponsiveComponent = (rulesets, tagName = 'div') =>
styled(tagName)`${buildStyles(rulesets)}`
const buildStyles = rulesets =>
rulesets.reduce(
(cssString, { constraint, width, rules }) =>
@AndreiF13
AndreiF13 / group-objects-by-property.md
Created December 11, 2019 18:25 — forked from JamieMason/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;

Pluck Unique Values from Array of Javascript Objects

Implementation

const pluck = key => array => Array.from(new Set(array.map(obj => obj[key])));

Usage

const useFetch = endpoint => {
const defaultHeader = {
Accept: "application/json",
"Content-Type": "application/json"
};
const customFetch = (
url,
method = "GET",
body = false,
headers = defaultHeader
@AndreiF13
AndreiF13 / finalFormHooks.ts
Created October 16, 2019 09:43 — forked from alitaheri/finalFormHooks.ts
Type safe react-final-form-hooks
import { useCallback, useRef, useState, useEffect, useMemo } from 'react';
import {
FormApi,
FormState,
FieldState,
Config,
FormSubscription,
FieldSubscription,
FieldValidator,
formSubscriptionItems,