Skip to content

Instantly share code, notes, and snippets.

View shash7's full-sized avatar

Shashwat amin shash7

View GitHub Profile
@shash7
shash7 / npmlist.txt
Created August 29, 2020 12:52
Dependency dump
+-- @microlink/mql@0.7.4
| +-- flat@5.0.2
| +-- got@11.5.2
| | +-- @sindresorhus/is@3.1.2
| | +-- @szmarczak/http-timer@4.0.5
| | | `-- defer-to-connect@2.0.0
| | +-- @types/cacheable-request@6.0.1
| | | +-- @types/http-cache-semantics@4.0.0
| | | +-- @types/keyv@3.1.1
| | | | `-- @types/node@14.0.27 deduped
class NodeUtils {
static path(node) {
let tests = []
// if the chain contains a non-(element|text) node type, we can go no further
for (;
node && (node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.TEXT_NODE);
@shash7
shash7 / sample-nuxt.config.js
Last active December 14, 2022 17:33
A SEO optimized nuxtjs config file. Comes with all standard meta tags as well as social tags. Quick configuration. Read the comments first before integrating in your config file.
/**
* Before copy-pasting this code inside your nuxt config file, read the instructions first.
*
* 1. Go to https://realfavicongenerator.net/ and generate a bunch of favicons.
* It will take only 5 minutes to generate them(assuming you have a base favicon in 512x512 size ready)
* When generating the favicons select the path directory as /favicons
* 2. Make a facebook cover image. Use something like figma or canva to create one quickly. Name the file cover.jpg
* 3. Inside your nuxt project create a folder called favicons and dump all the favicon files(generated from the favicon generator)
* as well as the facebook cover image.
* 4. Configure the variables below to your liking. You can also change the delimiter.
use Carbon_Fields\Container;
use Carbon_Fields\Field;
add_action( 'carbon_fields_register_fields', 'crb_attach_theme_options' );
function crb_attach_theme_options() {
Container::make( 'theme_options', __( 'Theme Options', 'crb' ) )
->add_fields( array(
Field::make('text', 'crb_text', 'Text Field' ),
Field::make('association', 'crb_association', 'Association'),
Field::make('checkbox', 'crb_checkbox', 'Checkbox')
@shash7
shash7 / globals.js
Created June 18, 2016 10:20
Global variables for nodejs
/* jslint undef: true */
/* global window, document, $ */
/* ----------------------------------------------------------------
* globals.js
*
* Contains setters and getters to store and retrieve global vars
* ---------------------------------------------------------------- */
/*
* particle.js
*
* Originally taken from http://alexanderjam.es/
*
* Menu:
* globals
* class
* class functions
* utils
@shash7
shash7 / panelize
Created June 24, 2015 16:01
Turn text into panels to create a visual hierachy
var stretch = 1;
function parseRGB(input) {
m = input.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
if( m) {
return [parseInt(m[1]),parseInt(m[2]),parseInt(m[3])];
} else {
return null;
}
}
function normalize(num) {
@shash7
shash7 / cache.js
Created August 25, 2014 10:36
A simple cache for storing objects in javascript
/* jslint undef: true, vars: true */
/* global window, document, $ */
/*
* cache.js
*
* Used for caching objects in an array
*/
@shash7
shash7 / timeloop
Created March 24, 2014 18:09
timeloop | A loop for delaying each iteration of a loop. Soooo meta
/*
* A loop for delaying each iteration of a loop
* How to use?
* var time = new TimeLoop(ms, iterations, callback);
* time(); // Executes the loop
*
* Also, the first parameter of the callback function is the counter of the loop
*/
var TimeLoop = function(ms, i, callback) {
@shash7
shash7 / mvc.js
Last active January 4, 2016 01:08
Component based framework for js apps.Dependent on jquery.
/*
*
* Custom MVC library
*
*
* Api reference :
* var mvc = new Mvc // options > debug : false
* var page = new mvc.Component({
* name : 'shash7', // some value