Skip to content

Instantly share code, notes, and snippets.


Diego E. Salazar DiegoSalazar

View GitHub Profile
tekin / .gitattributes
Last active Jan 4, 2021
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See for more details.
View .gitattributes
# Stick this in your home directory and point your Global Git config at it by running:
# $ git config --global core.attributesfile ~/.gitattributes
# See for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp

FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.

Effective Engineer - Notes

What's an Effective Engineer?


Git Cheat Sheet

Visit my blog.


Getting Started

git init


phawk / .screenrc
Last active Jan 22, 2021
Sample screenrc
View .screenrc
# Save this in ~/.screenrc
# Use bash
shell /bin/bash
autodetach on
# Big scrollback
defscrollback 5000
View screen_cheatsheet.markdown

Screen Quick Reference


Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r <session_name>
joshnuss / prisoners_dilemma.exs
Last active Dec 26, 2015
WIP Prisoner's Dilemma Simulation
View prisoners_dilemma.exs
# Prisoner's Dilemma
defmodule Scoreboard do
use GenServer.Behaviour
def start do
:gen_server.start_link({:local, :scoreboard}, __MODULE__, [], [])
def init do
{:ok, []}
iambibhas / scopes.txt
Last active Mar 14, 2021
Sublime Text 2: Snippet scopes
View scopes.txt
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
jakeonrails / Ruby Notepad Bookmarklet
Created Jan 29, 2013
This bookmarklet gives you a code editor in your browser with a single click.
View Ruby Notepad Bookmarklet
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
jwo / mysql.database.yml
Last active Apr 24, 2021
Sample config/database.yml from Rails. Postgres, MySQL, and SQLite
View mysql.database.yml
# Install the MYSQL driver
# gem install mysql2
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
# And be sure to use new-style password hashing:
DiegoSalazar / validate_credit_card.js
Last active Apr 8, 2021
Luhn algorithm in Javascript. Check valid credit card numbers
View validate_credit_card.js
// Takes a credit card string value and returns true on valid number
function valid_credit_card(value) {
// Accept only digits, dashes or spaces
if (/[^0-9-\s]+/.test(value)) return false;
// The Luhn Algorithm. It's so pretty.
let nCheck = 0, bEven = false;
value = value.replace(/\D/g, "");
for (var n = value.length - 1; n >= 0; n--) {