Skip to content

Instantly share code, notes, and snippets.

@IslamAzab
IslamAzab / Key bindings..sublime-keymap
Last active March 19, 2017 09:57
Sublime Shortcuts
preferences -> key bindings user
[
{ "keys": ["ctrl+t"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["ctrl+pageup"], "command": "next_view_in_stack" },
{
"draw_white_space": "all",
"font_size": 14,
"ignored_packages":
[
"Vintage"
],
// The number of spaces a tab is considered equal to
"tab_size": 2,
// Set to true to insert spaces when tab is pressed
@IslamAzab
IslamAzab / Installing Redis
Created August 4, 2014 16:01
Installing Redis
Prerequisites:
sudo apt-get install build-essential
sudo apt-get install tcl8.5
To install redis:
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
def html_truncate(input, num_words = 15, truncate_string = "...")
doc = Nokogiri::HTML(input)
current = doc.children.first
count = 0
while true
# we found a text node
if current.is_a?(Nokogiri::XML::Text)
count += current.text.split.length

Original source link

List current installed kernels

dpkg --get-selections | grep linux-image

e.g.

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@IslamAzab
IslamAzab / rtl support in gnome terminal.md
Last active August 17, 2022 20:52
How to enable Arabic support in GNOME terminal?
sudo apt-get install libfribidi0 libfribidi-dev

Download the appropriate package from here

vim /usr/share/applications/gnome-terminal.desktop

add this

Terminal=true

Exec=/usr/bin/bicon.bin

@IslamAzab
IslamAzab / .irbrc
Last active August 29, 2015 14:14 — forked from erichurst/.irbrc
# Make gems available
require 'rubygems'
begin
require "ap"
alias pp ap
rescue LoadError
puts "Please install the 'awesome_print' gem."
end
def self.reindex!
model_name = self.name.to_s
total = self.count
indexed = 0.to_f
progress = 0.to_f
row_length = 100.to_f
log_level = Sunspot::Rails::LogSubscriber.logger.level
time_start = Time.now
each_second = Time.now
per_second = 0