Skip to content

Instantly share code, notes, and snippets.

View surjithctly's full-sized avatar

Surjith S M surjithctly

View GitHub Profile
@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 / 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 / script.js
Created July 21, 2017 13:15
jQuery - Run only if Plugin Exists and the Element is found. Else Skip
// Cache class name
var $element = $('.element');
if ($element.length && $.fn.functionname) {
// Do awesome Stuff
}
@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 / Sublime Shortcuts.md
Last active March 20, 2016 07:14
Sublime Text 3 for Beginners (Designers or Developers)

Sublime 3 Shortcuts

Shortcut Description
Ctrl + Shift + P Command Palette
Ctrl + D Multi Edit : Select the next same matched word
Alt + F3 Select all occurences of selected text
Ctrl + Click Every place you click will create a cursor to edit
Ctrl + F then Alt + Enter Highlight all occurences of selected word and to edit at same time
@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 + ')')

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables