Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Js Akhil jsakhil

🎯
Focusing
View GitHub Profile
@jsakhil
jsakhil / FormsModulePlugin.php
Created Apr 19, 2022
FormsModulePlugin.php | File Path /core/anomaly/forms-module/src | getField for Mail Notification | {{ forms_getField(input,'field_slug') | raw }}
View FormsModulePlugin.php
<?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 Apr 14, 2022 — forked from sweetleon/ajax.autosave.naive.html
naive AJAX auto-save implementation
View ajax.autosave.naive.html
<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 Jan 16, 2022
CSS Grid Auto Fill Example
View grid.css
.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 Jul 29, 2021
Signature Pad jQuery Plugin
View sign.html
<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 Jul 21, 2021 — forked from omgmog/parallax-scroll.js
Simple parallax background scrolling with jQuery
View parallax-scroll.js
$(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 Jul 5, 2021
jQuery function to determine if an element is positioned within the viewport.
View isOnScreen.js
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
DYNAMIC SLICK DOTS
View slick_dots.js
// 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
Safari 11+ CSS | Code for only iOS Safari Compatibility
View safari_only_css.css
/* 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 Apr 8, 2021
Its for disabling scroll inside a section where onepage_sroll plugin is used
View disable_scroll.js
$('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;
View 1-handlebars-cheatsheet.hbs
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.