Skip to content

Instantly share code, notes, and snippets.

View jsakhil's full-sized avatar
🎯
Focusing

Js Akhil jsakhil

🎯
Focusing
View GitHub Profile
@jsakhil
jsakhil / FormsModulePlugin.php
Created April 19, 2022 13:47
FormsModulePlugin.php | File Path /core/anomaly/forms-module/src | getField for Mail Notification | {{ forms_getField(input,'field_slug') | raw }}
<?php namespace Anomaly\FormsModule;
use Anomaly\FormsModule\Form\Contract\FormRepositoryInterface;
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
use Anomaly\Streams\Platform\Assignment\Contract\AssignmentInterface;
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
use Anomaly\Streams\Platform\Support\Decorator;
use Anomaly\Streams\Platform\Support\Presenter;
/**
@jsakhil
jsakhil / ajax.autosave.naive.html
Created April 14, 2022 09:48 — forked from sweetleon/ajax.autosave.naive.html
naive AJAX auto-save implementation
<form method="POST" action="/our/url">
<textarea name="input" onChange="save(event)" />
</form>
<script language="javascript">
function save(event) {
var request = new XMLHttpRequest();
request.open(event.target.form.method, event.target.form.action);
request.send(new FormData(event.target.form));
}
@jsakhil
jsakhil / grid.css
Created January 16, 2022 08:21
CSS Grid Auto Fill Example
.grid_wrap {
width: 100%;
max-width: 100%;
display: grid;
margin: 0 auto;
grid-template-columns: repeat(auto-fill, minmax(25%, 1fr));
grid-auto-rows: 1fr;
grid-auto-flow: row dense;
grid-gap: 10px;
counter-reset: boxes;
@jsakhil
jsakhil / sign.html
Last active July 29, 2021 09:58
Signature Pad jQuery Plugin
<script src="https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.min.js"></script>
<div class="signature-wrap">
// Add Form field signature_base_64 and assign it to the form, Field type must be WYSIWYG
<input type="hidden" class="signature_base_64" name="signature_base_64" value="" />
<div id="signature-pad">
<div class="custom-signature-pad--body">
<canvas id="custom-signature-pad" width="398" height="160" style="touch-action: none;"></canvas>
</div>
@jsakhil
jsakhil / parallax-scroll.js
Created July 21, 2021 11:33 — forked from omgmog/parallax-scroll.js
Simple parallax background scrolling with jQuery
$(function() {
var $el = $('.parallax-background');
$(window).on('scroll', function () {
var scroll = $(document).scrollTop();
$el.css({
'background-position':'50% '+(-.4*scroll)+'px'
});
});
});
@jsakhil
jsakhil / isOnScreen.js
Created July 5, 2021 13:40
jQuery function to determine if an element is positioned within the viewport.
function isOnScreen(elem) {
if( elem.length == 0 ) {
return;
}
var $window = jQuery(window)
var viewport_top = $window.scrollTop()
var viewport_height = $window.height()
var viewport_bottom = viewport_top + viewport_height
var $elem = jQuery(elem)
var top = $elem.offset().top
@jsakhil
jsakhil / slick_dots.js
Created May 11, 2021 08:30
DYNAMIC SLICK DOTS
// DYNAMIC SLICK DOTS
function dynamic_slick_dots(slickItem, slickLimit){
if($(slickItem).length < slickLimit){
$(slickItem).parents('.slick-slider.slick-dotted').find('ul.slick-dots').hide();
}
}
// DYNAMIC SLICK DOTS
dynamic_slick_dots('.slick_slide:not(.slick-cloned)', 4);
@jsakhil
jsakhil / safari_only_css.css
Last active May 10, 2021 11:50
Safari 11+ CSS | Code for only iOS Safari Compatibility
/* SAFARI ONLY */
@media not all and (min-resolution:.001dpcm) {
@supports (-webkit-appearance:none) {
/* Define here the CSS styles applied only to Safari browsers (any version and any device)*/
}
}
/* SAFARI ONLY */
@jsakhil
jsakhil / disable_scroll.js
Last active April 8, 2021 11:03
Its for disabling scroll inside a section where onepage_sroll plugin is used
$('section').on('mouseenter', function(event) {
$('body').on('scroll mousewheel touchmove', stopScrolling);
});
$('section').on('mouseleave', function(event) {
$('body').off('scroll mousewheel touchmove', stopScrolling);
});
function stopScrolling(e) {
e.preventDefault();
e.stopPropagation();
return false;
Handlebars is a semantic web template system, started by Yehuda Katz in 2010.
Handlebars.js is a superset of Mustache, and can render Mustache templates in addition to Handlebars templates.
More: http://handlebarsjs.com/
1. Expressions.
1.1 Basic usage.