每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,欢迎关注开源日报。交流QQ群:202790710;电报群 https://t.me/OpeningSourceOrg


今日推荐开源项目:《Carbon帮你做出更漂亮的代码截图

推荐理由:Carbon让你可以改变你代码的语法主题、背景颜色、系统主题或者装饰来自定义你的图片,帮你做出更漂亮的代码截图让你发到社交网站上去分享。

使用carbon

  1. 直接在https://carbon.now.sh/中使用,或部署在本地
  2. (1)将你想要截图的代码片段复制过去

(2)直接将你的代码文件拖进去

(3)在https://carbon.now.sh/后追加GitHub gist id ,例如:

https://carbon.now.sh/YOUR_GIST_ID

  1. 愉快的更换语法主题,背景颜色,窗口主题或填充得到你要的效果
  2. 你可以选择开源项目精选:Carbon帮你做出更漂亮的代码截图来下载图片,也可以按开源项目精选:Carbon帮你做出更漂亮的代码截图共享链接

例如:Zenburn+BG:1D1F22+其他默认

开源项目精选:Carbon帮你做出更漂亮的代码截图

Seti + BG:93B2DB+ windows theme:3+ line number+ drop shadow

开源项目精选:Carbon帮你做出更漂亮的代码截图

当然,背景也可以自定义图片,你可以用骚气无比的方式来分享你的源码

注:Atom , VS Code, Sublime Text 3, Vim 等都可支持Carbon,详情自看官方说明

关于GitHub gist

代码片段管理服务,可以作为个人的代码管理器,文档管理器等等

官方说明:https://help.github.com/articles/about-gists/

知乎回答:https://www.zhihu.com/question/21343711

 

Atom(github专门为程序员推出的一个跨平台文本编辑器)

按shift-cmd-A,你可以在Carbon里打开你最近的Atom文件

 

VS Code

命令‘carbon’来打开你最近的 VS Code文件

 

Sublime Text 3

按你自己特定的键在你最近的Sublime Text 3文件打开可选择的项

 

Vim

使用函数CarbonNowSh()在你的最近的Vim/Neovim中打开可选择的项

 

作者介绍

  • Brian Dennis
开源项目精选:Carbon帮你做出更漂亮的代码截图

美国威斯康星大学大三的学生,学习计算机科学和应用数学,有管理和领导学生组织的能力,有编程马拉松(英语:hackathon,又译为黑客松,一个流传于黑客(hacker)当中的新词汇)的经验

个人主页:http://briandennis.io/

 

  • Michael Fix
开源项目精选:Carbon帮你做出更漂亮的代码截图

待人热忱,推动了麦迪逊城市创业的生态系统,喜欢设计网页,喜欢喝咖啡,爱好工科,也爱好艺术

个人主页:https://mfix22.github.io/


今日推荐英文原文:《Pseudo-Code, Humor, and the Art of Googling》作者:Joseph Cardillo

原文链接:https://medium.com/@josephcardillo/pseudo-code-humor-and-the-art-of-googling-71f6b5e8ce2e

Pseudo-Code, Humor, and the Art of Googling

The most important things I’ve learned about programming so far have nothing to do with writing code. Rather, they are the things that happen before and in-between the code writing.


When I’m first given a problem or assignment to work through, my gut reaction is to dive right in to coding or asking questions on Google, because it can seem counter-productive to do anything else. I’ve quickly realized this is not true.

The generals have a saying:
“Rather than make the first move
it is better to wait and see.
Rather than advance an inch
it is better to retreat a yard.” (Tao Te Ching, №69)

I’ve never been in battle, but I think the idea here is that in battle it might seem like moving forward is the most productive thing you could do, and that to retreat is to give ground to the enemy. To give them the advantage.

In regards to coding, I’m finding that taking a few steps back to get the big picture, write pseudo-code and think through my problem with pencil and paper (or in the text editor) goes a long way, sets me up for more insightful and thoughtful questions, and actually saves time in the long run.

Write in Pseudo-Code

When we were first encouraged to do this I didn’t see the point. Maybe because we were working on simpler problems that didn’t require the use of extensive pseudo-code. But as the assignments got more complicated, this has become invaluable.

It gives me a chance to flesh out the problem from beginning to end.

// My pseudo-code process:
// 1. Read over the problem.
// 2. Write out in long form what I’m trying to accomplish, even if I repeat verbatim parts of the question. Where am I starting? Where am I going? What path am I taking? What side-paths may I want to take along the way? What tools do I need? What kind of functionality?
// 3. Go back over my notes (from #2) and add in sub-thoughts to further flesh out the process and include questions I have for myself (or others, or Google) I’ll likely ask along the way.
// 4. Start coding.
// 5. Test each baby-step in the console.
// 6. Repeat step five.
// 7. Repeat step five.
// 8. Repeat step five. [...]

Think First, Then Google

As mentioned above, another gut reaction of mine is to ask questions on Google immediately. Besides, we’ve been told that eighty to ninety percent (or more) of a developer’s day is spent Googling how to do things. So why would I not do the same?

I cannot attest to this, not being a full fledged developer yet. But what I am realizing is that there are ways of Googling that are helpful to me, and some that are actually counter-productive.

I’m finding that when I turn to Google first, a part of my brain is actually shutting down.

If I turn to Google thoughtlessly, I’m not actually learning to think like a programmer.

What I mean is this: If I don’t take time to write pseudo-code and think through the details of the project, I’ll end up Googling in an inefficient way. I’ll end up wasting time, which in the short-term — even though writing psuedo-code might feel like I’m taking two steps back to go one-step forward — it actually is saving time and headaches along the way by helping me be more thoughtful about the questions I ask on Google, because I’ll be more likely to understand what I’m asking, and why I’m asking it.

Console.log(“everything”)

This is huge. I didn’t realize it at first, but this saves an enormous amount of time and energy, too. It gives a chance to test each idea in Chrome’s Developer Tools to see if it actually works, and if there are any errors or bugs to work out.

Failure is an opportunity. (№79)

This is where I think of the phrase: “Failure is an opportunity.” The console is unforgiving. Though, because of that, it is also my best friend. It doesn’t beat around the bush and tell me my code looks great, that I’m handsome and doing a great job, etc. If something’s broken, It lets me know. It doesn’t praise or berate me. It just tells me like it is. It keeps me humble and keeps me moving.

If psuedo-code helped me break the process down into baby-steps, the console helps me break it down into micro-steps.

For example, if one of my baby steps is to create a function that replaces the innerHTML of an element based in its id, the console gives me the ability to find out if my syntax is correct when I use jQuery to target that id, if I’m actually capturing the innerHTML, and if everything is properly formatted when I run the function. All without changing a single line of code.

The console gives me the chance to fail, and learn from my mistakes. It helps keep things moving, and target where I’m specifically getting stuck. It helps me ask better questions.

Have a Sense of Humor

Programming can be frustrating! And I’m just a baby at it. But if I can have a sense of humor along the way, it helps relieve the tension that tends to get me stuck. I try to write humorous things in my pseudo-code, even if I’m making fun of myself, because laughing at myself helps relieve the tension, and helps keep me grounded.

If frustration gets me stuck, humor is a way of getting unstuck. It helps keep the code flowing.

 


每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,欢迎关注开源日报。交流QQ群:202790710;电报群 https://t.me/OpeningSourceOrg