Skip to content

Instantly share code, notes, and snippets.

View camsong's full-sized avatar
🤖
GPTing

Shaoyin Song camsong

🤖
GPTing
View GitHub Profile
@domenic
domenic / promises.md
Last active July 17, 2025 03:03
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@pbyrne
pbyrne / performance.rb
Created September 27, 2012 16:28
Performance Comparison
# plain ActiveRecord
Benchmark.measure do
User.where(:activated => true).limit(200000).map(&:first_name)
end
# => 58.210000 12.970000 71.180000 ( 73.134415)
# writing the improved SQL by hand
Benchmark.measure do
ActiveRecord::Base.connection.select_all("select * from users where activated = 1 limit 200000").map { |attrs| attrs[:first_name] }
end
@agnoster
agnoster / README.md
Last active May 10, 2025 17:44
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@greypants
greypants / README.markdown
Last active October 17, 2023 05:49 — forked from reagent/nav_link.rb
RAILS 3: nav_link helper for adding 'selected' class to navigation elements
@cjcheshire
cjcheshire / fullscreen.scss
Created June 21, 2012 14:34
SASS 3.2 HTML5 Fullscreen Support
@mixin fullscreen() {
&:-webkit-full-screen {
@content;
}
&:-mozilla-full-screen {
@content;
}
&:full-screen {
@content;
}
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 27, 2025 14:32
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@justinko
justinko / Plea.markdown
Created May 30, 2012 19:40
Am I doing it wrong?

Dear Rubyists,

I just lost a contract because of my code in a Rails project.

The specific code in question is related to a "posting a comment" feature. Here are the details:

In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.

The "senior developer", whom is the stake holder's right hand man, said this:

@g3d
g3d / gist:2709563
Last active May 15, 2025 07:00 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan
@paulmillr
paulmillr / active.md
Last active July 22, 2025 02:26
Most active GitHub users (by contributions). https://paulmillr.com

Most active GitHub users (git.io/top)

The list would not be updated for now. Don't write comments.

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Because of GitHub search limitations, only 1000 first users according to amount of followers are included. If you are not in the list you don't have enough followers. See raw data and source code. Algorithm in pseudocode:

githubUsers