This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## React Setup with Vitejs | |
## To setup a react project is rather easy, simply pick the directory you want to store your projectn, | |
## open up a terminal there and run the following commands | |
npm init @vitejs/app vite-app --template react | |
or | |
npm init @vitejs/app vite-app --template vanilla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
st := []byte("The quick brown fox jumps over the lazy dog") | |
l := len(st) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Amazon Elastic Beanstalk | |
## Grand the access to node command | |
1. sudo su | |
2. vipw | |
3. nodejs:x:496:494::/tmp:/bin/bash (":wq" to save changes) | |
4. sudo su nodejs | |
5: PATH=$PATH:`ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin | |
6: node -v (enjoy :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "b2c", | |
"color": "bfd4f2" | |
}, | |
{ | |
"name": "b2b", | |
"color": "bfd4f2" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"489":{"title":"chrome.bookmarks - Google Chrome","url":"https://developer.chrome.com/extensions/bookmarks#method-getTree"},"490":{"title":"Modern Web Apps With React and Redux - Reducers and Actions","url":"https://code.tutsplus.com/courses/modern-web-apps-with-react-and-redux/lessons/reducers-and-actions"},"491":{"title":"Life Less Literary - The Adventures of Dan Sumption","url":"http://www.sumption.org/"},"492":{"title":"Feature Toggles","url":"http://martinfowler.com/articles/feature-toggles.html"},"493":{"title":"The FACE of Amazon","url":"https://sites.google.com/site/thefaceofamazon/home"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function safeParse(n) { | |
n = +n; | |
if (isNaN(n)) throw new TypeError('NANUMERR'); | |
if (0 > n) throw new TypeError('NEGNUMERR'); | |
return n | |
} | |
function safeFixed(n) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns an array of src values for an currently selected element | |
copy([].slice.call($0.querySelectorAll('img')).map(function(el){ return el.getAttribute('src'); })) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var currentIndex = 0; | |
var listLength = 9; | |
var dir = 1; // -1 - to go backwards | |
var nextIndex = ((currentIndex + listLength) + dir) % listLength; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// variables | |
var a = 10; | |
var b = 99; | |
// a^=b, b^=a, a^=b - swap variables using XOR operation, | |
// details: http://en.wikipedia.org/wiki/XOR_swap_algorithm | |
a^=b, b^=a, a^=b; | |
console.log('a', a); | |
console.log('b', b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Before run the example copy and paste this function into a browser console. | |
Example: | |
createBoundingBox($0); | |
createBoundingBox(document.getElementById('element-id')); | |
*/ | |
function createBoundingBox(parentEl) { | |
var body = document.body; | |
var pRect = parentEl.getBoundingClientRect(); | |
var box = document.createElement('div'); |
NewerOlder