Skip to content

Instantly share code, notes, and snippets.

View osnysantos's full-sized avatar
🏠
Working from home

Osny Netto osnysantos

🏠
Working from home
View GitHub Profile
@markerikson
markerikson / render-logic.js
Last active March 13, 2023 22:00
React render function organization
View render-logic.js
// See https://blog.isquaredsoftware.com/presentations/react-redux-ts-intro-2020-12/#/36 for slides
// My basic render function structure:
function RenderLogicExample({
someBoolean, // 1) Destructure values from `props` object
someList,
}) {
// 2) Declare state values
const [a, setA] = useState(0);
const [b, setB] = useState(0);
View eg.rb
class Whatever
attr_accessor :error
def grava_lead(attrs)
if some_condition
@error = "Some error"
return false
end
# ...
end
@rafaelstz
rafaelstz / osx_preferences.md
Created August 24, 2015 14:00
OS X Preferences
View osx_preferences.md

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@bradfrost
bradfrost / gist:59096a855281c433adc1
Last active September 4, 2023 15:01
Why I'm Not A JavaScript Developer
View gist:59096a855281c433adc1

Answering the Front-end developer JavaScript interview questions to the best of my ability.

  • Explain event delegation

Sometimes you need to delegate events to things.

  • Explain how this works in JavaScript

This references the object or "thing" defined elsewhere. It's like "hey, thing I defined elsewhere, I'm talkin' to you."

  • Explain how prototypal inheritance works.
@ChuckJHardy
ChuckJHardy / digital_ocean_setup.md
Last active October 27, 2023 17:51
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions
View digital_ocean_setup.md

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

Create a Droplet

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

View gist:304ac2b5cb9566774a2b
Topic.record_timestamps=false
Topic.includes(:replies).find_each do |t|
last_reply = replies.sort_by(&:created_at).last
t.replied_at = last_reply ? last_reply.created_at : t.created_at
t.save
end
@rkjha
rkjha / nginx-config-rails4-with-puma-ssl-version.conf
Last active November 2, 2023 11:57
Nginx config for rails 4 application using puma [ssl and non-ssl version]
View nginx-config-rails4-with-puma-ssl-version.conf
upstream myapp_puma {
server unix:/tmp/myapp_puma.sock fail_timeout=0;
}
# for redirecting to https version of the site
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
}
@staltz
staltz / introrx.md
Last active December 7, 2023 10:04
The introduction to Reactive Programming you've been missing
View introrx.md
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active December 5, 2023 13:49
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat Sheet.md

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\