Philocode – Telegram
زدم:
nano ~/.bashrc

بعد این خط رو اضافه کردم:
alias pma='xdg-open http://127.0.0.1:8001 && php -S 127.0.0.1:8001 -t /home/dreamweaver/phpmyadmin'


حالا وقتی توی ترمینال بزنم pma، اتوماتیک هم PHPMyAdmin رو ران می‌کنه و هم توی براوزرم باز می‌شه. :)
👍1🔥1
-- All the rows, everybody knows that!
SELECT COUNT(*) FROM users;
-- How many developers each company has.
SELECT company_id, COUNT(*) FROM `users` GROUP BY company_id;
-- How many verified users we have. (=not null values)
SELECT COUNT(verified_at) as verified_users FROM users;
-- How many languages should we support?
SELECT COUNT(DISTINCT language) FROM users;
👍3
PHP __toString() vs Go Stringer
👍4
مزایده آنلاین دومین 😋
Go/Gin/MySQL/Vue.js/Tailwind
4😢1
یه API هست که هر ثانیه فقط یه ریکوست از هر آی‌پی قبول می‌کنه. یعنی دومین ریکوست رو بفرستید، بلاک می‌شید.

ایده‌ام برای حل این چالش این بود که long-polling داشته باشیم (تا جواب نباشه، ریکوست معطل می‌مونه): به این صورت که من و شما توی یه ثانیه دوتا ریکوست می‌فرستیم و درخواست اطلاعات می‌کنیم:
Me: abcd
You: wxyz

این دوتا رو توی صف می‌ریزیم و یه تایمر هم هر سه ثانیه میاد و دیتای توی صف رو جمع‌شده توی یه ریکوست برای اون API می‌فرسته و نتیجه رو توی یه slice (یه چیزی شبیه آرایه) می‌ریزه که هر کدوممون اطلاعات خودمون رو ازش برداریم.

چالش رو حل می‌کنه، اما پیاده‌کردن همین long-polling خودش یه چالش بزرگ‌تره. 😁
🔥2
جالبه:
timeout 2 sleep 20
Philocode
جالبه: timeout 2 sleep 20
time sleep 2

real  0m2.004s
user 0m0.001s
sys 0m0.003s
جالب بود! 😎🥶
👍4
Philocode
Photo
How Docker generates random container names?

Docker will assign a randomly generated name to each container, if you don't provide a name while creating a container from an image. Currently I have a "peaceful_archimedes" and a "determined_hellman" on my machine!

1. The package "namesgenerator" is responsible for doing this:
https://lnkd.in/emJPDHpa
2. As you can see, the generated name consists of an adjective (left), and an underscore, and a name (right). The adjective and the name would be chosen from two arrays randomly.
3. The package "is officially frozen - no new additions will be accepted".
4. "At some future time, this may be replaced with something that sparks less controversy, but for now it will remain as-is."
5. Someone made a pull request about two years ago to remove Valentina Tereshkova from the names array, but he failed:
https://lnkd.in/eXscbCK5
6. "Steve Wozniak is not boring", I heartily laughed at this jode (joke-code, my invention), added by Solomon Hykes:
https://lnkd.in/evUuNa4i

Thanks to Soroush Moosapour for mentioning this package, so that I had the pleasure of reading the code.