Skip to content

Instantly share code, notes, and snippets.

@marwan-nwh
marwan-nwh / clean_code.md
Created September 27, 2022 10:40 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@marwan-nwh
marwan-nwh / git-aware-bash-prompt.md
Created September 3, 2019 23:42 — forked from eliotsykes/git-aware-bash-prompt.md
Git Aware Bash Prompt
@marwan-nwh
marwan-nwh / GitForWindowsSetup.md
Created February 28, 2019 13:31 — forked from dmangiarelli/GitForWindowsSetup.md
How to setup SSH with Git for Windows

How to setup Git for Windows

I know this document seems long, but it shouldn't be too difficult to follow. This guide is based on Windows, but every program here has Linux/Mac equivalents, and in most cases they're built-in. So, take a deep breath and go step by step.

The steps below are for GitHub, but the steps are almost idential for Bitbucket, Heroku, etc.

You'll probably want to make sure Chocolatey is installed, since it streamlines installing this stuff later. If you install via Chocolatey, you don't need to run the installers from the products' respective sites.

Cmder / ConEmu

Each YouTube video has 4 generated images. They are predictably formatted as follows:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
@marwan-nwh
marwan-nwh / ruby language
Created December 18, 2016 19:18 — forked from patriques82/ruby language
A summary of the book "The Ruby Programming Language" by David Flanagana and Yukihiro "Matz" Matsumoto
CONTENT
Expressions, Statements and Controlstructures
Equlaity
Assigments
The ||= idiom
Other assignments
Flip-flops
Iterators
Blocks
Control-flow keywords
@marwan-nwh
marwan-nwh / readability.rb
Last active August 29, 2015 14:26 — forked from emad-elsaid/readability.rb
import links content to facebook comments by mentioning this bot, you'll need to run it periodically using cronjob
#!/usr/bin/env ruby
# Author : Emad Elsaid (https://github.com/blazeeboy)
# **Usage** :
#
# * `ruby readability.rb <accesstoken>`
# this will get a long term access token from the short term one
# you can create a facebook app and get access token from here
# * `ruby readability.rb`
# will start the script
require 'open-uri'

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
import java.util.Scanner;
public class ipreader {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("enter your ip");
String ip=s.next();
String newip="";
char ipChar;
for(int i=0;i<ip.length();i++)