Skip to content

Instantly share code, notes, and snippets.

View aghyad's full-sized avatar
🤖
Never give up

Aghyad Saleh aghyad

🤖
Never give up
View GitHub Profile
@aghyad
aghyad / .vimrc
Created March 26, 2014 15:04
.vimrc
" .vimrc
" load up pathogen and all bundles
syntax on " show syntax highlighting
filetype plugin indent on
set autoindent " set auto indent
set ts=2 " set indent to 2 spaces
set shiftwidth=2
set expandtab " use spaces, not tab characters
@aghyad
aghyad / .tmux.conf
Created March 26, 2014 15:05
my .tmux.conf file
###########################
# Configuration
###########################
# use 256 term for pretty colors
set -g default-terminal "screen-256color"
# increase scroll-back history
set -g history-limit 5000
@aghyad
aghyad / .tmux.conf
Last active August 29, 2015 13:58 — forked from emachnic/.tmux.conf
.tmux.conf from emachnic
set -g prefix C-a # Make C-a the prefix instead of default
bind C-a send-prefix # Send to application
unbind C-b # Unbind C-b
set -sg escape-time 1 # Remove delay for keystrokes
setw -g mode-keys vi # Use vi mode
### Mouse mode ###
setw -g mode-mouse on # Toggle mouse mode globally
set -g mouse-select-pane on # Select pane using mouse

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@aghyad
aghyad / and_or_in_stmts_in_ruby
Last active August 29, 2015 14:11
"&&" and "||" in ruby statements (not if-stmts)
"&&" and "||" in ruby statements (not if-stmts):
stmt1 && stmt2
returns the first falsey result, or if no falsey's found, returns the last truthy result
ex:
'hello' && 'bye'
=> 'bye'
'hello' && false
=> false
false && 'hello'
@aghyad
aghyad / core_exts.rb
Last active August 29, 2015 14:11 — forked from shell/core_exts.rb
## Like a Symbol#to_proc but for array
class Array
def to_proc
lambda {|object|
self.map{|symbol| object.send(symbol.to_sym)}
}
end
end
@aghyad
aghyad / genmac.rb
Last active August 29, 2015 14:22 — forked from cyberkov/genmac.rb
#!/usr/bin/env ruby
#require 'rubygems'
#require 'pry'
#require 'pp'
# This scripts returns a list of MAC addresses.
# Usage:
# ./$0 LIMIT START END
# ./genmac.rb 5 00:50:56:00:00:00 00:50:56:3F:FF:FF
#
@aghyad
aghyad / quick_sort.rb
Last active December 21, 2015 00:58
Algorithms in Ruby: Quick Sort
class Array
def aghyad_quick_sort
return self if length <= 1
pivot = self[length/2]
return find_all { |i| i < pivot }.quick_sort + find_all { |i| i == pivot } + find_all { |i| i > pivot }.quick_sort