Skip to content

Instantly share code, notes, and snippets.

View ruben1's full-sized avatar

Ruben Vicario Gonzalez ruben1

View GitHub Profile
@ruben1
ruben1 / install.sh
Last active August 11, 2021 08:18
Pre-commit git hook for CCI frontend projects
# Install
cd <project root>
touch .git/hooks/pre-commit # create pre-commit file
chmod +x .git/hooks/pre-commit # make it executable
# copy pre-commit contents to the file
# Use
git commit # will trigger the hook. you might see prettier rules fixed after committing
git commit --amend -n # after checking prettier changes look good, commit again and skip the hook this time

System Design Cheatsheet

Step One: Framing The Problem

  • Identify the use cases that are in scope
  • Determine constraints based on scoped use cases

use case : the things your system needs to be do.

constraints : the things your system will have to consider to be able to do stuff

{
"bold_folder_labels": true,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 3,
"caret_style": "solid",
"color_scheme": "Packages/User/SublimeLinter/Oceanic Next (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"font_size": 15,
@ruben1
ruben1 / latency.markdown
Created November 27, 2015 23:09 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

require 'open-uri'
require 'nokogiri'
require 'csv'
url = ''
doc = Nokogiri::HTML(open(url))
containers = doc.css('') # -> css selector for container
str = ''
@ruben1
ruben1 / example.js
Last active August 29, 2015 14:21 — forked from addyosmani/example.js
// Example 1
mediator.name = 'Doug';
mediator.subscribe('nameChange', function(arg){
console.log(this.name);
this.name = arg;
console.log(this.name);
});
mediator.publish('nameChange', 'Jorn');

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
// Import node modules
var Q = require('q');
var Promise = require('bluebird');
var GitHubApi = require('github');
// Instantiate github API.
// NOTE: This is just used for async demonstration purposes, you can imagine any other async functions through this example
var github = new GitHubApi({
version: '3.0.0'
});