Skip to content

Instantly share code, notes, and snippets.

View hatemalimam's full-sized avatar

Hatem Alimam hatemalimam

View GitHub Profile
@hatemalimam
hatemalimam / redux-persist.js
Created April 18, 2020 11:09
transform to blacklist a promise
import { createTransform } from 'redux-persist';
const blacklistTransform = createTransform((inboundState, key) => {
if (key === 'Auth') {
return inboundState.delete('refreshTokenPromise');
}
return inboundState;
});
const persistOptions = {
@hatemalimam
hatemalimam / textractUtils.js
Created January 1, 2020 17:20
Textract Form extraction example
const _ = require("lodash");
const aws = require("aws-sdk");
const config = require("./config");
aws.config.update({
accessKeyId: config.awsAccesskeyID,
secretAccessKey: config.awsSecretAccessKey,
region: config.awsRegion
});
@hatemalimam
hatemalimam / ChartDataBean.java
Created July 10, 2017 15:29
ChartistJSF Plugins Bean
@ManagedBean
@ViewScoped
public class ChartDataBean implements Serializable {
private LineChartModel pluginsModel;
public ChartDataBean() {
createCharts();
}
@hatemalimam
hatemalimam / plugins.css
Created July 10, 2017 15:26
ChartistJSF Plugins CSS
.example-plugin-threshold .ct-line {
stroke-dasharray: 5px;
animation: dashoffset 1s linear infinite;
}
.example-plugin-threshold.ct-chart .ct-series .ct-bar.ct-threshold-above,.example-plugin-threshold.ct-chart .ct-series .ct-line.ct-threshold-above,.example-plugin-threshold.ct-chart .ct-series .ct-point.ct-threshold-above {
stroke: #f05b4f;
}
.example-plugin-threshold.ct-chart .ct-series .ct-bar.ct-threshold-below,.example-plugin-threshold.ct-chart .ct-series .ct-line.ct-threshold-below,.example-plugin-threshold.ct-chart .ct-series .ct-point.ct-threshold-below {
@hatemalimam
hatemalimam / plugins.xhtml
Last active July 10, 2017 15:30
ChartistJSF plugins
<ct:chart id="lineChart" type="line" model="#{chartDataBean.pluginsModel}" plugins="myPlugins"
styleClass="example-plugin-threshold">
</ct:chart>
<script>
//plugins array
var myPlugins =
[
Chartist.plugins.ctThreshold({
threshold: 4
<p:selectBooleanCheckbox itemLabel="Check All"
widgetVar="checkAllWV"
onchange="selectAllCheckBoxes(PF('checkAllWV'),PF('manyCheckWV'))">
</p:selectBooleanCheckbox>
<p:selectManyCheckbox widgetVar="manyCheckWV">
<f:selectItems value="#{mainBean.list}"/>
</p:selectManyCheckbox>
<script>
@hatemalimam
hatemalimam / diagram.xhtml
Last active May 25, 2017 22:30
PrimeFaces diagram events
<p:diagram id="diagram" value="#{mainBean.diagramModel}" style="height:400px" styleClass="ui-widget-content" widgetVar="diagramWV" />
<p:growl widgetVar="growlWV" />
<script>
//<![CDATA[
$(document).ready(function () {
setTimeout(function () {
for (var key in PF('diagramWV').canvas.getAllConnections()) {
@hatemalimam
hatemalimam / ChartDataBean.java
Last active August 29, 2015 14:20
Chart Data Provider for ChartistJSF
import org.chartistjsf.model.chart.AspectRatio;
import org.chartistjsf.model.chart.ChartSeries;
import org.chartistjsf.model.chart.PieChartModel;
import org.primefaces.event.ItemSelectEvent;
@ManagedBean
public class ChartDataBean {
private PieChartModel pieChartModel;
@hatemalimam
hatemalimam / pie.xhtml
Created April 30, 2015 13:06
Pie Chart Markup for ChartistJSF
<ct:chart id="pieChart" type="pie" model="#{chartDataBean.pieChartModel}" >
<p:ajax event="itemSelect" listener="#{chartDataBean.pieItemSelect}" update="pieChartMessage" />
</ct:chart>
<p:message id="pieChartMessage" for="pieChart" showDetail="true" />