Skip to content

Instantly share code, notes, and snippets.

View ArunHub's full-sized avatar

Arun M ArunHub

View GitHub Profile
@ArunHub
ArunHub / sassfile.txt
Created March 28, 2019 14:47
sass imports in gulp problem
https://github.com/dlmanning/gulp-sass/issues/1
Right now if any of my sass files have an @import in them I get an error like this:
stream.js:94
throw er; // Unhandled stream error in pipe.
^
source string:1: error: file to import not found or unreadable: 'normalize'
@ArunHub
ArunHub / togglemoreless.js
Created March 27, 2019 06:31
toggle icons for more/less or advanced filter
function() {
$(this).hasClass("active") ?
($(this).removeClass("active"),
$(".fresh-widgets .icon-question").show(),
$(".fresh-widgets .icon-cross").hide())
:
($(this).addClass("active"),
$(".fresh-widgets .icon-question").hide(),
$(".fresh-widgets .icon-cross").show())
}
@ArunHub
ArunHub / css-extract.js
Created March 26, 2019 14:49
css extraction
function css(el) {
var sheets = document.styleSheets, ret = [];
el.matches = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector
|| el.msMatchesSelector || el.oMatchesSelector;
for (var i in sheets) {
@ArunHub
ArunHub / npm.md
Last active March 28, 2019 15:11
npm commands
  • To run a file from folder:
    • for example: I want run a gulpfile.js as index.js in tasks folder from root directory

      npm command: gulp --gulpfile tasks

      Here --gulpfile denotes gulpfile.js and searches it as index.js in tasks folder

Install $ npm install -g npm-check Use $ npm-check

@ArunHub
ArunHub / main.js
Last active March 19, 2019 14:37
Create basic code for main.js, root component, vendor.ts and webpack files in react seed app
import React from "react";
import ReactDOM from "react-dom"
import RootComponent from "./app/RootComponent";
ReactDOM.render(
<RootComponent />,
document.getElementById('root')
);
@ArunHub
ArunHub / devtool.txt
Last active March 15, 2019 07:57
features of devtool i know
coverage
using console
copy object
snippets
finding files
sources logpoint
copy response
inspecting elements for dom
event,xhr,dom breakpoint
watch
@ArunHub
ArunHub / array-rotate.js
Last active April 10, 2019 20:09
rvp is for practise instant code in desktop
let ia=0, ib=0, an=a.length, bn=b.length;
let r=[];
while(ia<an && ib<bn) {
let iia = ia;
let iib = ib;
let bb = b.charAt(ib);
while(a.charAt(iia)<=bb) iia++;
r.push(a.substring(ia,iia));
ia=iia;
let aa = a.charAt(ia);
@ArunHub
ArunHub / git.txt
Last active March 28, 2019 14:46
Git commands
git checkout -b develop
...make some changes...
...notice master has been updated...
...commit changes to develop...
git checkout master
git pull
...bring those changes back into develop...
@ArunHub
ArunHub / cmd.txt
Created February 15, 2019 12:00
command line tips
rename a file
rename filename.txt tofilename.txt
rename multiple files
rename *.txt *.js
for directory also, same procedure
this for directory with space
@ArunHub
ArunHub / joinarray.js
Created August 23, 2018 06:42
join array of different data types
function joinArray(str, retVal) {
var first = getParts(retVal.symbol, str);
var removed = first.splice(retVal.pos).join('');
first = first.join('');
var retArr = Array.of(first, retVal, removed);
return retArr;
}
function getParts(input, string) {
var regex = new RegExp(input, 'i')