Skip to content

Instantly share code, notes, and snippets.

View adi518's full-sized avatar
🌴
On vacation

Adi adi518

🌴
On vacation
View GitHub Profile
@Integralist
Integralist / bem.html
Last active March 11, 2018 14:43
In CSS/BEM: how do we name a sub-block that is related to its parent block?
<!-- Simplest solution is to just label the element as a element within an element -->
<div class="block">
Content
<div class="block__element">
Content
<div class="block__element__element">
Content related to `block__element`
</div>
</div>
</div>
@ronapelbaum
ronapelbaum / README.MD
Last active March 28, 2018 18:33
interview: front end developer

interview: front end developer

basic algorithm

  1. implement function reverseString(str)
  2. implement function factorial(n)
  3. implement function removeFromArray(arr, arg1, arg2, ...)

javascript

  1. What will be the output of this:
@ronapelbaum
ronapelbaum / package.json
Last active March 29, 2018 05:57
NPM Version Management Auto-Patch
{
"name": "my-package",
"version": "1.2.0",
"scripts": {
"patch-version": "node patch-version.js",
"tag-version": "node tag-version.js \"release-tag\"",
"prerelease": "npm run patch-version && npm run tag-version",
"release": "npm publish",
}
}
@atorralb
atorralb / iterate_through_pagination_in_nightmare.js
Created April 9, 2016 00:16
iterate through a pagination site with nightmarejs
var Nightmare = require('nightmare');
var vo = require('vo');
vo(run)(function(err, result) {
if (err) throw err;
});
fu
@phun-ky
phun-ky / webpack.config.js
Last active July 10, 2018 10:51
webpack + postcss + extract-text-plugin = no CSS duplicates
postcss: () => {
return [
cssnano({
reduceIdents: false,
discardDuplicates: true,
autoprefixer: true
})
];
},modules: {
loaders: [{
@imgsrc
imgsrc / colorConverter.ts
Created August 12, 2018 16:35
converter hex to rgb / rgb to hex
type Color = { r: number, g: number, b: number };
function hexToRgb(hex: string): Color {
if (hex.length === 3) {
let [hr, hg, hb] = hex.split(''); // ['F', '0', '0']
return hexToRgb(`${hr}${hr}${hg}${hg}${hb}${hb}`);
}
let [r, g, b] = [0, 2, 4]
.map(offset => hex.substring(offset, offset + 2)) // ['FF', '00', '00']
.map(hex => parseInt(hex, 16)); // [255, 0, 0]
@iliran11
iliran11 / gist:807bb4b434853680213818d598e7c5ac
Created October 20, 2018 14:50
Check which prop has changed that caused re-render
componentDidUpdate(prevProps) {
for (const index in prevProps) {
if (prevProps[index] !== this.props[index]) {
console.log(index, this.props[index], '-->', prevProps[index]);
}
}
}
@NoamELB
NoamELB / index.scss
Last active October 20, 2018 22:25
tabs example
@import "../../../../SASS/lib/core";
@import "../../Cards/Card/mixins";
.tabs {
padding: 0;
border: $constants-border;
border-radius: 8px;
.tabs_header {
display: flex;
@kvedantmahajan
kvedantmahajan / linked_list_OLOO_style.js
Last active December 4, 2018 16:14
Implementation of Linked list in Javascript using OLOO ( Object linked with another object ) style of coding i.e. no "new" keyword and sugar coated classes
/**
* Initialize your data structure here.
*/
var MyLinkedList = {
head: null,
length: 0,
Node: function (val){
return {
@pr1sm
pr1sm / updateNpm.bat
Last active March 10, 2019 16:43 — forked from johnmcase/updateNpm.bat
Update npm on windows
rem see https://github.com/coreybutler/nvm-windows/issues/300
@echo off
SETLOCAL EnableDelayedExpansion
if [%1] == [] (
echo Pass in the version you would like to install, or "latest" to install the latest npm version.
) else (
set wanted_version=%1