Skip to content

Instantly share code, notes, and snippets.

View surjithctly's full-sized avatar

Surjith S M surjithctly

View GitHub Profile
@surjithctly
surjithctly / smoothscroll.js
Created June 29, 2017 14:42
Smooth Scroll Plugin
/* SmoothScroll for websites v1.2.1. Licensed under the terms of the MIT license.
People involved: Balazs Galambosi (maintainer), Michael Herf (Pulse Algorithm), Edwin Ang (optimzation and added support) */
(function() {
var defaultOptions = {
frameRate: 150,
animationTime: 750,
stepSize: 120,
pulseAlgorithm: true,
pulseScale: 8,
pulseNormalize: 1,
@surjithctly
surjithctly / dropdown.html
Created November 29, 2016 07:55
Bootstrap Sub menu
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
@surjithctly
surjithctly / Mac Shortcuts.md
Last active August 3, 2017 13:37
Mac Keyboard Shortcuts

Mac Keyboard Shortcuts

Applications

Task Shortcut
Spotlight Search Command + Space
Force Quit Applications Command + Option + Escape
Force Quit The Current Application Command + Shift + Option + Escape

Browsing

@surjithctly
surjithctly / Readme.md
Last active August 19, 2017 20:11
NSE Open Hour Breakout JS Bookmarklet

Installation

javascript:!function(){function d(){(window.myBookmarklet=function(){console.log("Open Breakout Code Started \n Created by Surjith S M \nhttp://surjithctly.in/"),console.log("scanning"),$("#dataTable tr").each(function(){$("td",this).css("background",""),$("td a",this).css("color","");var a=$("td:nth-child(4)",this).text().replace(/,/g,""),b=$("td:nth-child(5)",this).text().replace(/,/g,""),c=$("td:nth-child(6)",this).text().replace(/,/g,""),d=$("td:nth-child(1)",this).text();a==b&&($("td:nth-child(5), td:nth-child(1)",this).css({color:"white",background:"Red"}),$("td:nth-child(1) a",this).css({color:"white"}),console.log("Go Short Found: "+d)),a==c&&($("td:nth-child(6), td:nth-child(1)",this).css("background","Lime"),console.log("Go Long Found: "+d))}),console.log("finished scanning \nThank you!")})()}var a="1.3.2";if(void 0===window.jQuery||window.jQuery.fn.jquery<a){var b=!1,c=document.createElement("script");c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+a+"/jquery.mi
@surjithctly
surjithctly / scroll-reveal.js
Created March 4, 2016 08:54
Scroll Reveal Menu JS
/* ================================================
On Scroll Menu
================================================ */
$(window).scroll(function() {
if ($(window).scrollTop() > 600) {
$('.js-reveal-menu').removeClass('reveal-menu-hidden').addClass('reveal-menu-visible');
} else {
$('.js-reveal-menu').removeClass('reveal-menu-visible').addClass('reveal-menu-hidden');
}
@surjithctly
surjithctly / nicescroll.js
Created February 23, 2016 15:24
Smooth Scroll (Browser Scrollbar)
function ssc_init(){if(document.body){var e=document.body,s=document.documentElement,c=window.innerHeight,t=e.scrollHeight;if(ssc_root=document.compatMode.indexOf("CSS")>=0?s:e,ssc_activeElement=e,ssc_initdone=!0,top!=self)ssc_frame=!0;else if(t>c&&(e.offsetHeight<=c||s.offsetHeight<=c)&&ssc_root.offsetHeight<=c){var r=document.createElement("div");r.style.clear="both",e.appendChild(r)}ssc_fixedback||(e.style.backgroundAttachment="scroll",s.style.backgroundAttachment="scroll"),ssc_keyboardsupport&&ssc_addEvent("keydown",ssc_keydown)}}function ssc_scrollArray(e,s,c,t){if(t||(t=1e3),ssc_directionCheck(s,c),ssc_que.push({x:s,y:c,lastX:0>s?.99:-.99,lastY:0>c?.99:-.99,start:+new Date}),!ssc_pending){var r=function(){for(var o=+new Date,n=0,a=0,i=0;i<ssc_que.length;i++){var l=ssc_que[i],_=o-l.start,u=_>=ssc_animtime,d=u?1:_/ssc_animtime;ssc_pulseAlgorithm&&(d=ssc_pulse(d));var f=l.x*d-l.lastX>>0,m=l.y*d-l.lastY>>0;n+=f,a+=m,l.lastX+=f,l.lastY+=m,u&&(ssc_que.splice(i,1),i--)}if(s){var p=e.scrollLeft;e.scrollLeft+=n,
@surjithctly
surjithctly / script.js
Last active January 21, 2016 12:22
Object fit CSS and Fallback - Cross Browser
// Thanks Primož Cigler
// https://medium.com/@primozcigler/neat-trick-for-css-object-fit-fallback-on-edge-and-other-browsers-afbc53bbb2c3#.rydx9pub4
if ( ! Modernizr.objectfit ) {
$('.post__image-container').each(function () {
var $container = $(this),
imgUrl = $container.find('img').prop('src');
if (imgUrl) {
$container
.css('backgroundImage', 'url(' + imgUrl + ')')
@surjithctly
surjithctly / bootstrap-nav-menu-hover.css
Created October 17, 2015 08:06
Boostrap navigation menu on Hover (Desktop Only)
/************************
* Nav Menu on Hover
***********************/
/*only for screens greater than 992px */
@media (min-width: 992px) {
.navbar .navbar-nav > li.dropdown > ul {
display: block;
opacity: 0;
visibility: hidden;
@surjithctly
surjithctly / simple-phpmailer.php
Created October 13, 2015 11:19
Simple PHPMailer() Contact Form
<?php
require_once "phpmailer/class.phpmailer.php";
//PHPMailer Object
$mail = new PHPMailer;
//From email address and name
$mail->From = "from@yourdomain.com";
$mail->FromName = "Full Name";
@surjithctly
surjithctly / retina.js
Created August 26, 2015 13:45
Retina Images JQuery @2x Replace
/* retina
--------- */
if (window.devicePixelRatio > 1){
$(".retina").imagesLoaded(function(){
$(".retina").each(function(){
var src = $(this).attr("src").replace(".","@2x.");
var h = $(this).height();
var w = $(this).width();
$(this).attr("src",src).css({height:h,width:'auto'});
});