Skip to content

Instantly share code, notes, and snippets.

View codernik's full-sized avatar
💭
I may be slow to respond.

Nikhil codernik

💭
I may be slow to respond.
  • Mumbai
View GitHub Profile
@codernik
codernik / split.sh
Created February 11, 2021 18:35
Shell script for spliting csv file into multiple parts.
#!/bin/bash
FILENAME=main.csv
HDR=$(head -1 $FILENAME)
split -l 1000 $FILENAME xyz
n=1
for f in xyz*
do
if [ $n -gt 1 ]; then
echo $HDR > Part${n}.csv
fi
@codernik
codernik / YouTube Video Data Tool.html
Created July 31, 2019 11:24 — forked from jgrant41475/YouTube Video Data Tool.html
Fetches YouTube Video Information and creates a json-ld Video Object
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Foundation | Welcome</title>
<link rel="stylesheet" href="css/foundation.css" />
</head>
<body>
<div class="row">
@codernik
codernik / gist:e5efea0c1ceb7e9e7353f793e2e9e9ac
Created August 20, 2018 07:21
Horizontal timeline JS Code
$(document).ready(function($) {
var timelines = $('.cd-horizontal-timeline'),
eventsMinDistance = 100;
(timelines.length > 0) && initTimeline(timelines);
function initTimeline(timelines) {
timelines.each(function() {
var timeline = $(this),
timelineComponents = {};
//cache timeline components
@codernik
codernik / add popup-left class on last isotope item
Created March 23, 2018 10:48
Function to add popup-left class on last isotope item after filter is applied
$container.on( 'layoutComplete',
function( event, laidOutItems ) {
console.log( 'Isotope layout completed on ' + laidOutItems.length + ' items' );
var last_x = false;
jQuery(laidOutItems).removeClass('popup-left');
jQuery(laidOutItems).each(function(i, v){
console.log(i);
var current_x = jQuery(this.element).offset().left;
if( last_x !== false && last_x > current_x && typeof laidOutItems[i-1] !== 'undefined'){
@codernik
codernik / add-remove-isotope-hidden-class
Created March 23, 2018 09:39
Add and remove isotope-hidden class
var itemReveal = Isotope.Item.prototype.reveal;
Isotope.Item.prototype.reveal = function() {
itemReveal.apply( this, arguments );
$( this.element ).removeClass('isotope-hidden');
};
var itemHide = Isotope.Item.prototype.hide;
Isotope.Item.prototype.hide = function() {
itemHide.apply( this, arguments );
$( this.element ).addClass('isotope-hidden');
@codernik
codernik / loadynamic.js
Last active June 15, 2016 07:34
Javascript function for loading resources dynamically with onload callback
/**
* Accept three parameters
* @param {string} type : either js or css
* @param {string} url : url of the resource to be loaded
* @param {function} : function to be called back after resource loaded (Optional)
*/
function loadResource(type, url, callbackFunction) {
var tag, mimeType;
if (type == 'js') {
tag = 'script';