Skip to content

Instantly share code, notes, and snippets.

View nickgnd's full-sized avatar
👨‍💻
Hacking my way

Nicolò G. nickgnd

👨‍💻
Hacking my way
View GitHub Profile
@PJUllrich
PJUllrich / big-o.md
Last active October 14, 2024 21:37
Big-O Time Complexities for Elixir Data Structures

Big-O Time Complexities for Elixir data structures

Map [1]

Operation Time Complexity
Access O(log n)
Search O(log n)
Insertion O(n) for <= 32 elements, O(log n) for > 32 elements [2]
Deletion O(n) for <= 32 elements, O(log n) for > 32 elements
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@pdincau
pdincau / readme.md
Last active July 11, 2024 06:12
Study Path on microservices
@armw4
armw4 / redux-is-smarter-than-you-think.md
Last active June 19, 2021 20:10
Optimizing your react components via redux....shouldComponentUpdate for free and more...

The Beginning

Yes...it's true...redux is smart....smarter than you even know. It really does want to help you. It strives to be sane and easy to reason about. With that being said, redux gives you optimizations for free that you probably were completely unaware of.

connect()

connect is the most important thing in redux land IMO. This is where you tie the knot between redux and your underlying components. You usually take state and propogate it down your component hiearchy in the form of props. From there, presentational

The unknown-prop warning will fire if you attempt to render a DOM element with a prop that is not recognized by React as a legal DOM attribute/property. You should ensure that your DOM elements do not have spurious props floating around.

There are a couple of likely reasons this warning could be appearing:

  1. Are you using {...this.props} or cloneElement(element, this.props)? Your component is transferring its own props directly to a child element (eg. https://facebook.github.io/react/docs/transferring-props.html). When transferring props to a child component, you should ensure that you are not accidentally forwarding props that were intended to be interpreted by the parent component.

  2. You are using a non-standard DOM attribute on a native DOM node, perhaps to represent custom data. If you are trying to attach custom data to a standard DOM element, consider using a custom data attribute (https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes).

  3. React does not yet reco

@pmontrasio
pmontrasio / safe_s3.rb
Last active December 23, 2021 08:37
Compress a file, encrypt it, upload it to S3. Download, decrypt, uncompress.
#!/bin/env/ruby
# gem "aws-sdk", "~> 2"
require "rubygems"
require "zlib"
require "rubygems/package"
require "securerandom"
gem "aws-sdk"
require "aws-sdk"
var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@Dr-Nikson
Dr-Nikson / README.md
Last active August 12, 2024 10:45
Auth example (react + redux + react-router)
@dpoindexter
dpoindexter / a-limit-react-work.md
Last active April 20, 2017 12:12
React Foundation Grid

"Push work down the tree"

One disadvantage of the top-down rendering approach we use is that the closer to the root of the application a component lives, the more it will be rerendered. The root component will be rerendered every time any data changes.

This is probably not a big deal for applications without much dynamic state, but let's say you have a input box at the bottom of a large tree of components (which will happen on pretty much any page containing a form). The user types, and every keystroke causes the entire app to rerender!

Well, this might be a big deal, or it might not be, depending on how you design your components. Some general guidelines will help us architect React apps that are fast by default, and don't need a whole lot of manual optimization.

HTML is work, components are placeholders