I hereby claim:
- I am owahab on github.
- I am owahab (https://keybase.io/owahab) on keybase.
- I have a public key ASA_02T9U3IPEzc_kNYuth9sU9QlFSJUcQrGnZRVNPfTogo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiSQpks1opZzxN2535jwSn/2AmO1Gz9Zdwo6QTXRBxdlN1B+K0Ktlv0dDCwvqb70qEan3iG8gp2lTQAId6r4hhH3/yXonvs9vk8YgrZ0E5fdzETQ/SkHnlYkQYY6gwWRvEihFszAMMwQaJ0n28fo40Ga1tY2/ZD/iYap8kp0pYXxOzm4p5hzCbGMRoHdBvZ0yLQw2k/npmpp9EX5PZ0n/FQoaFpuYXS5uJrhqnpdl8Bv15DoWYihIaGZPIs77s70Z3pNk9di9QZ3hX4kDdLiDSceempYi3zT5h5RCICcXlF0N4Dr3aB2AxwPTMsv6Bk1L/MVNua01zVJLIgxu3uKe9 omar@omars-laptop |
#!/usr/bin/env bash | |
set -e | |
echo -n "Publishing dummy messages: " | |
while true; do | |
echo -n "." | |
date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
message="{\"id\": \"$(uuidgen)\", \"created_at\": \"$date\", \"some_key\": \"some value\"}" | |
echo $message | kafkacat -P -b 0.0.0.0:9092 -t my_dummy_queue | |
sleep 0.8 |
echo '* Installing essential tools...' | |
sudo apt-get update | |
sudo apt-get -y install vim git-core curl zlib1g-dev build-essential module-assistant libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties openssl libreadline6-dev | |
echo '* Installing Chrome...' | |
sudo sh -c "echo 'deb http://dl.google.com/linux/deb/ stable main' > /etc/apt/sources.list.d/chrome.list" | |
sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get -y install google-chrome-stable |
# Gems | |
# ================================================== | |
# Use unicorn web server | |
gem "unicorn" | |
# For encrypted password | |
gem "bcrypt-ruby" | |
# Store sessions in database | |
gem 'activerecord-session_store', github: 'rails/activerecord-session_store' | |
# Authentication | |
gem "devise" |
# Run using the command: | |
# rspec -c --require PATH_TO/sound.rb --format Sound --format documentation | |
class Sound | |
RSpec::Core::Formatters.register self, :example_failed | |
RSpec::Core::Formatters.register self, :example_passed | |
def initialize(output) | |
@output = output | |
end |
# app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
rescue_from CanCan::AccessDenied do |exception| | |
# Make sure we don't redirect to an HTML page | |
# in API requests because this is absolutely a bad idea | |
unless request.accept == 'application/json' | |
# Solutions in order of preference: | |
# # Solution #1: Show a full page with Access Denied | |
# render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false) |
def form_errors object | |
return '' if object.errors.empty? | |
if object.errors.count > 1 | |
messages = object.errors.full_messages.map { |msg| content_tag(:li, msg) }.join | |
sentence = I18n.t("errors.messages.not_saved", | |
:count => object.errors.count, | |
:resource => object.class.model_name.human.downcase) | |
html = <<-HTML |
#!/bin/sh | |
# | |
# This hook does two three things: | |
# | |
# 1. update the "info" files that allow the list of references to be | |
# queries over dumb transports such as http | |
# | |
# 2. if this repository looks like it is a non-bare repository, and | |
# the checked-out branch is pushed to, then update the working copy. | |
# This makes "push" function somewhat similarly to darcs and bzr. |
(* | |
organize - hierarchy | |
This Folder Action handler is triggered whenever items are added to the attached folder. | |
The script organizes the added files into a folder hierarchy that follows the following structure: | |
YYYY/M/D | |
Where YYYY is four-digit year, M is month and D is the day. | |
Copyright 2010 Omar Abdel-Wahab <[email protected]>. | |
You may not incorporate this code into your program(s) without | |
a written permission from the author but you're free to use it AS IS |