Skip to content

Instantly share code, notes, and snippets.

View HamidOsouli-zz's full-sized avatar
🖥️
Always Learning

Hamid HamidOsouli-zz

🖥️
Always Learning
View GitHub Profile
@HamidOsouli-zz
HamidOsouli-zz / analyzerCRA.js
Created September 29, 2021 11:10
Webpack bundle analyzer for CRA (create-react-app)
process.env.NODE_ENV = 'production';
const webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const webpackConfigProd = require('react-scripts/config/webpack.config')('production');
const chalk = require('chalk');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const green = text => {
return chalk.green.bold(text);
package sample;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
@HamidOsouli-zz
HamidOsouli-zz / AyandehDepositValidator.js
Last active September 19, 2021 19:07
Ayandeh Deposit Validator with Javascript
const checkValidDeposit = (accountNumber) => {
if (accountNumber.length < 13){
return false;
}
let total = Number(accountNumber[11]) * 5;
total += Number(accountNumber[10]) * 7;
total += Number(accountNumber[9]) * 13;
total += Number(accountNumber[8]) * 17;
total += Number(accountNumber[7]) * 19;
total += Number(accountNumber[6]) * 23;

ES6 Setup with Babel 7

npm init -y
npm i --save-dev nodemon
npm install --save-dev @babel/core @babel/cli @babel/preset-env @babel/node

Create a .babelrc config in your project root. Insert the following

{
@HamidOsouli-zz
HamidOsouli-zz / verification.java
Created September 28, 2020 13:56
verification.java
package com.itextpdf.samples.signatures.chapter05;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfReader;
import com.itextpdf.signatures.PdfPKCS7;
import com.itextpdf.signatures.SignatureUtil;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import java.io.IOException;
package adanic.signer.rishe.services;
import com.itextpdf.kernel.geom.Rectangle;
import com.itextpdf.kernel.pdf.PdfDictionary;
import com.itextpdf.kernel.pdf.PdfName;
import com.itextpdf.kernel.pdf.PdfReader;
import com.itextpdf.kernel.pdf.StampingProperties;
import com.itextpdf.signatures.BouncyCastleDigest;
import com.itextpdf.signatures.DigestAlgorithms;
import com.itextpdf.signatures.ExternalBlankSignatureContainer;
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
@HamidOsouli-zz
HamidOsouli-zz / gist:927b255bdf0500a905583231835e8356
Created February 3, 2019 12:21
Common vendor chunk webpack
templateList.push(
new CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.weedoo.js',
minChunks: ({ resource }) => /node_modules/.test(resource),
})
);
templateList.push(
new CommonsChunkPlugin({
name: 'common',
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
// There are other ways to enforce a function expression:
!function () { /* ... */ }();
~function () { /* ... */ }();
-function () { /* ... */ }();
+function () { /* ... */ }();
void function () { /* ... */ }();
//In contexts where an expression is expected, wrapping in parentheses is not necessary:
var f = function () { /* ... */ }();
true && function () { /* ... */ }();
0, function () { /* ... */ }();