Skip to content

Instantly share code, notes, and snippets.

View fupslot's full-sized avatar
💭
I may be slow to respond.

Eugene Brodsky fupslot

💭
I may be slow to respond.
View GitHub Profile
@fupslot
fupslot / react_tailwindcss_vite
Created April 11, 2022 10:09
React + TailwindCSS + Vite.js
## 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
package main
import (
"fmt"
)
func main() {
st := []byte("The quick brown fox jumps over the lazy dog")
l := len(st)
@fupslot
fupslot / beanstalk node command
Created February 6, 2018 13:25
elastic beanstalk node command not found
# 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 :)
[
{
"name": "b2c",
"color": "bfd4f2"
},
{
"name": "b2b",
"color": "bfd4f2"
},
{
{"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"}}
function safeParse(n) {
n = +n;
if (isNaN(n)) throw new TypeError('NANUMERR');
if (0 > n) throw new TypeError('NEGNUMERR');
return n
}
function safeFixed(n) {
// returns an array of src values for an currently selected element
copy([].slice.call($0.querySelectorAll('img')).map(function(el){ return el.getAttribute('src'); }))
var currentIndex = 0;
var listLength = 9;
var dir = 1; // -1 - to go backwards
var nextIndex = ((currentIndex + listLength) + dir) % listLength;
@fupslot
fupslot / swap_variables.js
Created February 8, 2016 13:08
swap variable values (not temporary variable)
// 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);
@fupslot
fupslot / createBoundingBox
Last active February 2, 2016 16:03
Draws a bounding box for a given element on the page
/*
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');