Skip to content

Instantly share code, notes, and snippets.

View IcodeNet's full-sized avatar
😀

Byron Thanopoulos IcodeNet

😀
View GitHub Profile
@IcodeNet
IcodeNet / gist:8a218898b3dddfea52d0b0bb807dd627
Created November 13, 2023 09:15 — forked from SackeyDavid/gist:d24315dd844d51b3e70af062fdcf5941
Turing Coding Challenge Practise Test - Problem 2
// console.log("Hello, World!");
var countElements = function(arr) {
var result = 0;
// output = 0;
// count elements
for (var i = 0; i < arr.length; i++) {
if(arr.includes(arr[i] + 1)) {
result+= 1
}
# Interview Question Practice
## Iteration 1
- Describe the difference between a cookie, sessionStorage and localStorage. [-hint-](https://github.com/turingschool/lesson_plans/blob/3ee469be5fdc94c926a88ca510106848b0339731/ruby_04-apis_and_scalability/client_side_storage.markdown) [web APIs]
- What are `data-` attributes good for? [-hint-](https://css-tricks.com/almanac/selectors/a/attribute/) [html]
- Have you used or implemented media queries or mobile specific layouts/CSS? [-hint-](http://frontend.turing.io/lessons/module-1/intro-responsive.html) [css]
@IcodeNet
IcodeNet / upload.js
Created March 3, 2022 12:32 — forked from ibreathebsb/upload.js
file upload from dataUrl with axios
// Note: only for modern browser
import axios from 'axios'
// helper function: generate a new file from base64 String
const dataURLtoFile = (dataurl, filename) => {
const arr = dataurl.split(',')
const mime = arr[0].match(/:(.*?);/)[1]
const bstr = atob(arr[1])
let n = bstr.length
const u8arr = new Uint8Array(n)
@IcodeNet
IcodeNet / Example.tsx
Created August 17, 2021 08:30 — forked from stolinski/Example.tsx
Route Transitions with Framer Motion
const FakeComponent = () => {
return (
<AnimatedRoutes exitBeforeEnter initial={false}>
<RouteTransition exact path="/some-route">
<NewUsers />
</RouteTransition>
<RouteTransition exact path="/yo" >
<Users />
</RouteTransition>
</AnimatedRoutes>
@IcodeNet
IcodeNet / on-jsx.markdown
Created April 27, 2021 08:42 — forked from chantastic/on-jsx.markdown
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@IcodeNet
IcodeNet / cognito.spec.js
Created January 15, 2021 07:31 — forked from wordyallen/cognito.spec.js
Testing Cognito
require('dotenv').config()
import {exec} from 'child_process'
import {
CognitoUserPool as Pool,
CognitoUserAttribute as Attribute,
CognitoUser as User,
AuthenticationDetails as Details,
} from 'amazon-cognito-identity-js'
import {LocalStorage} from 'node-localstorage'
import prompt from 'prompt'
@IcodeNet
IcodeNet / squash rebase workflow.md
Last active December 18, 2020 15:45
squash rebase workflow #git

What is the squash rebase workflow? It’s simple – before you merge a feature branch back into your main branch (often master or develop), your feature branch should be squashed down to a single buildable commit, and then rebased from the up-to-date main branch. Here’s a breakdown.

Pull master branch

git pull origin master

Create bug/feature branch

@IcodeNet
IcodeNet / npm-upgrade-bleeding.sh
Created November 5, 2020 07:58 — forked from othiym23/npm-upgrade-bleeding.sh
a safe way to upgrade all of your globally-installed npm packages
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
@IcodeNet
IcodeNet / find port process and kill on a mac.md
Created August 10, 2020 10:02
Check which process is using port #mac

sudo lsof -iTCP -sTCP:LISTEN -P | grep :5001

then

sudo kill -9 [processId]

@IcodeNet
IcodeNet / steps to add ngrx effects into an angular app.md
Created May 29, 2020 06:54
[ngrx effects] How do I add NgRx effects into an Angular app #ngrx

There is a basic set of steps to use NgRx effects in your applications.

  • First, npm install the @ngrx/effects package.
  • Build an effect to process an action and dispatch the success and fail actions.
  • Initialize the effects module in the root module.
  • Register feature module effects, and
  • finally process the success and fail actions in the reducer.