DEV Community

Cover image for Dev's, share something you know that most don't

Dev's, share something you know that most don't

Shrijal Acharya on August 29, 2023

Hey dev's πŸ‘‹ Share anything – be it tools, hacks, techniques, or services – that you know that most don't. It can be as simple as an editor extensi...
Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard
$ alias fuck='sudo $(fc -ln -1)'
$ alias please=fuck
$ apt-get install something
permission denied
$ fuck
installing something
Enter fullscreen mode Exit fullscreen mode
Collapse
 
goodeejay profile image
Jasur Yusupov

What about:

$ alias fuck='sudo !!'
Enter fullscreen mode Exit fullscreen mode
Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

Same thing but it doesn't work with fish

Collapse
 
shricodev profile image
Shrijal Acharya

This is crazy. πŸ€£πŸ™Œ

Collapse
 
thomasbnt profile image
Thomas Bnt

This one is πŸ˜†πŸ˜†πŸ˜†

Collapse
 
ben profile image
Ben Halpern

In Ruby, basically everything in the language is hackable β€” and it's remarkably easy.

Want to add behavior to the Array class, so if I wanted to be able to call [5, 15, 25].astrological_sign, I can define that behavior by adding this to the project:

class Array
  def astrological_sign
    return "Array is empty" if self.empty?

    avg = self.sum.to_f / self.size
    case avg
    when 0..10
      "Aries"
    when 10..20
      "Taurus"
    when 20..30
      "Gemini"
    when 30..40
      "Cancer"
    when 40..50
      "Leo"
    when 50..60
      "Virgo"
    when 60..70
      "Libra"
    when 70..80
      "Scorpio"
    when 80..90
      "Sagittarius"
    when 90..100
      "Capricorn"
    when 100..110
      "Aquarius"
    else
      "Pisces"
    end
  end
end
Enter fullscreen mode Exit fullscreen mode

Voila

numbers = [5, 15, 25]
puts numbers.astrological_sign  # Output will be "Taurus"

more_numbers = [35, 45, 55]
puts more_numbers.astrological_sign  # Output will be "Virgo"
Enter fullscreen mode Exit fullscreen mode
Collapse
 
shricodev profile image
Shrijal Acharya

Ruby is so flexible, this seems really cool! 😯

Collapse
 
azasypkin profile image
Aleh Zasypkin

I know developers can be quite skeptical about Oracle. However, unlike AWS, Azure, and GCP, you can utilize Oracle Cloud to set up a free cloud deployment with 1-4 ARM64 nodes. For example, this is a great opportunity for learning how to set Kubernetes cluster up from scratch or even for running a few small products, as I do (check out the Hosting section in my post): dev.to/azasypkin/running-secutilsd...

Collapse
 
tqbit profile image
tq-bit

This is great until Oracle disables it due to low usage (had a node-red instance taking up little traffic).

Whole thing was gone after 3 months without any warning. If you're aware of this and just use it to goof around, it's perfectly ok tho.

Collapse
 
azasypkin profile image
Aleh Zasypkin

Indeed, there's always a catch. I've been running a few projects there with regular traffic, and everything has been going smoothly for almost two years now.

Collapse
 
techsnack profile image
TechSnack - Technology Tutorials

Lambda functions are essentially just anonymous functions which return a callable function in most languages

Collapse
 
shricodev profile image
Shrijal Acharya

Agreed!πŸ™Œ

Collapse
 
shricodev profile image
Shrijal Acharya

There are some cool snippets to create functional component and layout component in your typescript Next.js application.

  "Typescript React Function Component": {
    "prefix": "fc",
    "body": [
      "import { FC } from 'react'",
      "",
      "interface ${TM_FILENAME_BASE}Props {",
      "  $1",
      "}",
      "",
      "const $TM_FILENAME_BASE: FC<${TM_FILENAME_BASE}Props> = ({$2}) => {",
      "  return <div>$TM_FILENAME_BASE</div>",
      "}",
      "",
      "export default $TM_FILENAME_BASE"
    ],
    "description": "Typescript React Function Component"
  },
  "Typescript React Layout Component": {
    "prefix": "lc",
    "body": [
      "import { FC, ReactNode } from 'react'",
      "",
      "interface ${TM_FILENAME_BASE}Props {",
      "  children: ReactNode",
      "}",
      "",
      "const $TM_FILENAME_BASE: FC<${TM_FILENAME_BASE}Props> = ({ children }) => {",
      "  return <div className='$1'>{ children }</div>",
      "}",
      "",
      "export default $TM_FILENAME_BASE"
    ],
    "description": "Typescript React Layout Component"
  },
Enter fullscreen mode Exit fullscreen mode
Collapse
 
johnylab profile image
JoΓ£o Ferreira

HTML is more complex than you think and you should learn it deeply to make your work better. You can make any component more efficient, accessible and SEO friendly.

Collapse
 
skyops117 profile image
SkyHops

For a young dev, knowing how to make AS3 loaders for datamining flash player apps is an oldschool skill I learned on the go.
Today it's HTML5 CSS JS.