89 karma · joined April 8, 2014
Rust is a unique language in that it deallocates memory on the heap
without requiring the writer to call free,
while at the same time having no need for a garbage collector.
Someone correct me if I'm wrong but surely this is not unique - don't Objective C and Swift have automatic reference counting which accomplishes much the same thing?However, metaprogramming is a power that should be used wisely. When implemented unnecessarily it reduces readability (and probably performance) for no real gain.
The devise source contains some great examples of metaprogramming used properly:
https://github.com/plataformatec/devise/blob/master/lib/devi...
Metaprogramming has a place in Ruby but for the examples in the article there are far more readable ways to implement it.
Readability > cleverness every single time.
Not saying it isn't useful, in fact I have a project in which this would be a very good fit and I might even implement it there.
There are a tonne of average-to-poor looking girls on Tinder who have very good photos of themselves that paint them in a much more flattering light than they really deserve. Take a leaf out of their book.
Tinder is the most superficial distillation of dating out there, your entire judgement of the person is based on a few photos (and often just the first one).
You need 4 photos, show them in this order:
One full body shot of you with a clear image of your face, one of you topless (if you have the body for it), one of you looking cool with your friends, and one of you doing something you like, preferably some sort of adventurous hobby like climbing or diving
PAY TO GET PROFESSIONAL PHOTOS DONE. I can't emphasize this enough, more than anything else this will drastically improve your results.
The 'about me' field is almost irrelevant. Keep it to 3 sentences or less. When you get a match, push for a meetup at a bar (or your house if you feel bold) as soon as possible, preferably within 24 hours. Get their actual phone number within the first five messages. THE GIRL ALREADY LIKES YOU, there is no need to play silly games at this point.
I also use a Tinderbot to automatically like all the girls. I wrote my own version based off the work of somebody who reverse-engineered the API, my repo is here https://github.com/samphilipd/tinderzapper . When I feel like going on some dates, I just run that for a few days, unlike all the unattractive matches and push for meetups with the rest. It's a pure numbers game.
BELIEVE ME there are girls out there who will find you attractive and want to meet up with you, you simply have to sift through the junk to find them.
The above is pretty much exactly what I do. I'm only slightly above-average looking and very below-average height (5ft4). I do workout so I have a somewhat decent body. I've been on countless dates this year and got laid with 10-15 girls just through tinder.
Anyone can get a date on Tinder with professionally taken photos. In fact, most of the girls on there already know the importance of photos and are very skilled at showing photos that present them in the best possible light.
Don't get me wrong, I think Ruby is a great language and I use it every day to get paid, but it is not a speed queen. Ruby's strengths lie in flexibility, fast iteration, readable code and permitting a functional style.
In most practical web applications the big bottlenecks will be either view rendering or database. Choosing to put any focus at all on performance of something like parallel vs serial assignment (unless you are doing something truly pathological) is a complete waste of time.
It will have no noticeable difference to the end user and distracts from the far more important job of making your code modular, extensible and readable.
If need your code to be fast and you are running Ruby, you already lost. Use Java or a compiled language instead.
Ever wonder why it itches in those first couple of weeks if you decide to grow your beard out?
Look at that picture.
Shaving with a straight-blade razor basically leaves a bunch of tiny little hypodermic needles behind. When those suckers start growing out, they curl back into your face and start jabbing you, resulting in that annoying itching sensation.
If you want to grow your beard out, take my advice and make your last shave with an electric razor, it's a lot more comfortable.
https://github.com/bbatsov/rubocop
Fast enough to integrate into a continuous integration build process and catches a lot of dumb mistakes/typos before deploying to production.
So what then is the CORRECT way of doing this comparison in C, avoiding potential overflow pitfalls?
x = 1987654321 and y = -1987654321? Then the difference between them is -319658654 (negative) which proves that x is less than y. That’s less than correct.
Which is completely 100% wrong. Surely the difference would be x - y i.e (1987654321 - (-1987654321)) = (1987654321 + 1987654321) = 3975308642.Which is perfectly ok, because that's positive and so proves x is greater than y. So this comparison works just fine for negative integers...
Everyone is needy. Everyone always needs help. People have an infinite capacity to suck up your help and they will always need more.
Probably like many programmers, I love producing work for other people that makes them happy. There is nothing that delights me more than watching someone's face light up while using my software and saying "Oh, this is EXACTLY what I need!"
The problem is there are many people out there who will happily take your best work and pay little to nothing for it. I've learned this from bitter personal experience.
A truly selfless person would give their best work away forever for as little as they needed to survive. But this kind of generosity will leave you penniless and the kind of people that use your work for nothing will not thank you for it.
Your employer only pays you because he needs you. If you respond to neediness by giving, you lose your power and your ability to get paid for your work.
To retain wealth requires a kind of dulling of your own innate urge to help others. Because nobody else will stop you from giving and giving and giving until you are an exhausted shell with nothing to show for it.
I'm not saying this is the ideal way to behave, but we have to live in the reality that exists, not an imaginary idealized one.
With no kids or dependents, this is more than enough to live on. I paid rent and food comfortably, had plenty of time to learn guitar, go outside and skateboard, meet girls and even had enough leftover to buy myself a new Macbook Pro. Plus it was a fun and social job.
You could live on even less if you were determined, for inspiration on frugal living read Walden by Henry David Thoreau.
Priorities change though - right now I suppose I 'work' about 10 hours a day, six days a week. This is because I decided I was going to learn to code and got motivated and driven to become good at it. Building a skill takes a lot of hours of focus and concentration but it's not 'work' if you get excited about it.
The online form doesn't seem to be working...
For copying out code I use the same text editor that I program in.
If you want to make quick notes, there is absolutely no better tool than a notebook and pencil.
It's time tested and been proven to work for the past 2,000 years. It offers the minimum possible barrier between your thoughts and the page. It allows completely free expression with no limits on what characters you can type or where you draw your lines. You can erase and rewrite arbitrary areas as many times as you want using an eraser. The battery will never run out, it's very cheap and there's no screen to smash if you drop it.
FYI this isn't the opinion of some ancient luddite who still thinks we should be programming with punch cards. I'm 25 and have been hacking and playing with computer hardware and software since I was 12.
And I still think a moleskin pad and mechanical pencil is hands down the absolute best UI for crystallizing thoughts. If you are using anything flashier you are wasting your time on the tool rather than the substance of what you are thinking.
Pulseaudio was Lennart's previous project. It broke everything in linux sound for a while, everybody moaned and hated it and said it was the worst thing since the crucifixion of Christ.
Yet, name one problem you had with sound on linux in the past year? There are very few. Pulseaudio now just works(tm) and is a unseed, unheard of part of the plumbing.
If you remember what is was like messing with ALSA and (shudders) OSS before pulseaudio came along you will agree that the current state of affairs is a million miles better. It used to be really difficult to get more than one application to be able to play sound at a time. I remember compiling sound drivers from source just to get them working. Configuring ALSA config files to get surround sound working was practically a black art. Creating manual scripts that unmute the sound card on every boot because the driver didn't initialize it properly.
With pulseaudio, I never have to worry about any of that and configuring surround sound takes me two clicks of the mouse.
Lennart did a fantastic job with pulseaudio, he took on a dirty problem that nobody else dared to touch and went through years of criticism to produce a really high quality solution that solved the linux audio problem so well that you don't hear complaints about it anymore.
In light of that, I trust him to do a good job with systemd. It'll be a couple of years of everyone moaning and bitching and whining about it, then one day it will have become a seamless part of the plumbing, everyone will take it for granted and wonder how they ever managed fighting with shell scripts and fragmented init systems before systemd came along.
It's ironic that Lennart Poettering is probably the most abused developer in the entire OSS ecosystem, yet he is one of the people contributing most to it. For our sake, I'm glad he has such a thick skin. If I was him I'd have quit this game long ago.
I'm on my third read of it. The first time I tried to implement all the exercises in Ruby and failed around chapter 7 when the language ran out of expressive power. The second time round I implemented it in Javascript and got to chapter 9 before the syntax became too much of an obstruction to seeing what the code was doing (the good parts of Javascript are actually quite similar to Scheme in some ways but the syntax is just horrible).
This third time round I am implementing it in the language it was actually written in, Scheme. And having tried it with two other languages I can suddenly see why LISP is so suited for certain types of problems.
My 'magic moment' came when I finally grokked how the Y combinator works. It was like since I started learning how to code 4 years ago I had been continuously trying and failing to get two mirrors to line up perfectly so the images went off into infinity, and suddenly I got it just right and caught a glimpse of the wonderful self-referential simplicity of the entire of computation.
I use Ruby in my daily work but I want to start using more Clojure. There is a mathematical purity to LISP that other languages don't have.
It's like the whole language itself IS the fixed point function for humans interacting with computers.
I experimented with the Uberman sleep schedule myself as a student (i.e. 2 hours sleep a day, split into 20 minute naps). I stuck rigidly to the schedule over the course of three weeks but despite near-perfect discipline, it only got harder and harder.
The hours between 1am to 5am were the hardest. I would stay awake because the program required it (and supposedly it gets easier as your body 'adjusts') but between these hours I was totally useless. I couldn't read because my eyes would unfocus, I had blackouts where I couldn't remember anything. Usually I would just sit and stare catatonically at a wall.
I started breaking things and falling over due to malcoordination from the sleep deprivation and finally gave up after spending a night hallucinating that strange figures were appearing out of the wood patterns on my desk.
I slept for 24 hours and felt like a completely different person after I woke up.
So I encourage you to actually try this yourself, and see if it works. Just don't drive, operate heavy machinery or in fact do anything remotely risky during the experiment. Sleep deprivation can be dangerous.
Personally, I think the 2 hours is enough theory is garbage.
https://github.com/samphilipd/the-little-schemer/blob/master...
I wrote an implementation of Scheme in Javascript to use as I work through the excellent book 'The Little Schemer'. Turns out you can implement a basic version of the language in just 7 functions.
It's Turing complete and you can use the base methods to build any function you need.