Skip to content

Instantly share code, notes, and snippets.

View icodejs's full-sized avatar

Tahir Joseph icodejs

View GitHub Profile
@icodejs
icodejs / config
Created May 26, 2021 10:26 — forked from pksunkara/config
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
[sendemail]
smtpencryption = tls
@icodejs
icodejs / test.tsx.test
Created March 24, 2021 09:11
Mocking React Components with Jest
jest.mock("../src/Icon", () => {
return {
__esModule: true,
namedExport: true,
default: () => {
return <div></div>;
},
};
});
tahjoseph ~/Code/landingapp (VLX-5758/placeholder-bugs✔)
(☛ ゚ヮ゚) ☛ pgrep node
49521
49525
tahjoseph ~/Code/landingapp (VLX-5758/placeholder-bugs✔)
(☛ ゚ヮ゚) ☛ pkill node
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"name": "Attach to existing process",
"skipFiles": ["<node_internals>/**"],
"request": "attach",
"restart": true,
"port": 9229
import {
SELECT_MIDI_CONTROLLER,
SELECT_NUMBER_OF_KEYBOARD_OCTAVES,
SET_WEB_MIDI_SUPPORTED,
} from './action-types';
export const selectMidiController = ({ selectedDeviceName }) => ({
type: SELECT_MIDI_CONTROLLER,
selectedDeviceName,
});
import {
SELECT_MIDI_CONTROLLER,
SELECT_NUMBER_OF_KEYBOARD_OCTAVES,
SET_WEB_MIDI_SUPPORTED,
} from './action-types';
export const initialState = {
selectedDeviceName: 'APC Key 25',
webMidiSupported: false,
};
@icodejs
icodejs / get-first-and-last.js
Created April 8, 2019 14:26
Get first and last elements in array, ES6 way
let {0 : a ,length : l, [l - 1] : b} = [1,2,3,4,5,6,7,8,9,0];
console.log(a, b)
JSON.stringify(Array.from($('.table-data tr').map(function () {
return $(this).find("td:nth-child(2)").text()
})).filter(function (url) {
return url.indexOf('https://www.maxfactor.com/uk/') > -1;
}).sort())
@icodejs
icodejs / animatedScrollTo.js
Created October 3, 2017 14:06 — forked from joshbeckman/animatedScrollTo.js
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;
@icodejs
icodejs / combinations.js
Created May 5, 2016 16:00 — forked from axelpale/combinations.js
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,