Skip to content

Instantly share code, notes, and snippets.

Avatar

Hamid Osouli HamidOsouli

View GitHub Profile
View ES6_Setup_With_Nodemon.md

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

{
View 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;
View PadES
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;
View pom_pades.xml
<?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>
View gist:927b255bdf0500a905583231835e8356
templateList.push(
new CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.weedoo.js',
minChunks: ({ resource }) => /node_modules/.test(resource),
})
);
templateList.push(
new CommonsChunkPlugin({
name: 'common',
View webpack.prod.conf.js
'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')
View MultipleWayOfIIFE.js
// 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 () { /* ... */ }();
@HamidOsouli
HamidOsouli / MultiTernary.js
Created Nov 10, 2018
this is the multi conditional with ternary operator for Javascript
View MultiTernary.js
let i = true;
let j = 14;
ans = i ? (j > 10 ? (j%7 === 7 ? 14 : 54 ) : 66) : 99;
// returns 14 because i === true && j > 10 && j%7 === 0
View serviceConainer.php
To bind a dependency to some class in laravel
$this->app->bind(‘App\Helpers\Stripe’, function($app){
$api_key = config(‘services.stripe.api_key’);
return new \App\Helpers\Stripe($api_key);
});