Skip to content

Instantly share code, notes, and snippets.

View bbasata's full-sized avatar

Baraa Basata bbasata

View GitHub Profile

When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$

@bbasata
bbasata / hello-ruby.md
Created November 6, 2017 21:44
Hello Ruby
  1. Programming Ruby: the classic “pick-axe” book. it’s a tome — i haven’t read it cover-to-cover. i think it’s useful for the first few chapters & then coming back to it as a reference when i need to get more in-depth on a topic: https://pragprog.com/book/ruby4/programming-ruby-1-9-2-0 — i’m a bit surprised that it seems not to have been updated for Ruby 2.1, 2.2, 2.3, or 2.4 :)

  2. Ruby Koans: I found this really useful for getting over the initial learning curve with Ruby. Fun and approachable. http://rubykoans.com/ — I think this is also a bit dated, though likely still great for fundamentals

  3. Michael Hartl’s Ruby on Rails Tutorial helped me get over the initial learning curve with Rails.

  4. Learn Ruby the Hard Way — I have not read this one. It’s the newest learning-Ruby book that I know of, and I generally have a positive opinion of Zed Shaw’s “* the Hard Way” series.

I would recommend #4 and maybe #2 to someone starting with Ruby. #3 if you want to make sense of Rails. #1 as a reference, tho

@bbasata
bbasata / gist:8e5c6d7943908bb7bc20
Created October 18, 2015 17:35
Ignite talk proposal for devopsdays detroit
[Ignite] Three ways to automate application deployment to Amazon Web Services
Comparing and contrasting full-stack automated app deployment using:
* Ansible, a task-centric tool with uses from configuration management to cloud provisioning
* Terraform, an model-/graph-centric tool for cloud provisioning
* Convox, a Heroku-like open source Platform-as-a-Service offering that can be deployed into your Amazon Web Services account
@bbasata
bbasata / gist:5c5ec40650371e62e970
Last active August 29, 2015 14:19
twitter-pairing with @magnusstahre
SUBMODULE=lib/ansible/modules/core
SUBMODULE_COMMIT=4d9ce9cf2cdee14b1c417e92059d4ef83dbcc457
for superproject_tag in $(git tag); do
git ls-tree -r $superproject_tag | grep $SUBMODULE | awk '{ print $3 }' | while read submodule_commit_in_superproject_tag; do
(cd $SUBMODULE && git rev-list $submodule_commit_in_superproject_tag | grep $SUBMODULE_COMMIT >/dev/null && echo "Found submodule commit in superproject tag $superproject_tag")
done
done
@bbasata
bbasata / gist:7559018
Created November 20, 2013 07:17
Another CoreOS gist
Another CoreOS gist
@bbasata
bbasata / gist:7558982
Created November 20, 2013 07:12
Hello again
Hello again
@bbasata
bbasata / gist:3548170
Created August 31, 2012 02:34
"Where is your domain model?" : A Talk

Where is your domain model?

A domain model is much more than the “M” in MVC. As Martin Fowler writes, “Learning how to design and use a Domain Model is a significant exercise--one that has led to many articles on the ‘paradigm shift’ of objects use.”

Let’s talk about evolving a domain model in sustainable ways that allow a codebase to organically grow in a way that supports agility and adaptability. Highlights include:

  • What is a domain model? What are the alternatives?
  • What is sustainable software development?
  • Ubiquitous language, and thinking twice about naming something a Manager, Service, or DAO
@bbasata
bbasata / bowling_game_spec.rb
Created December 20, 2011 05:40
A bowling game
module Enumerable
def sum(identity=0)
inject(identity) { |sum,each| sum + each }
end
end
class BowlingGame
class Frame
def initialize
@rolls = []
@bbasata
bbasata / factorial_spec.rb
Created November 5, 2011 02:04
A simple example of RSpec
class Integer
def factorial
raise if self < 0
self > 0 ? (1..self).reduce(&:*) : 1
end
end
describe Integer, '#factorial' do
context "for values larger than 1" do
example { 2.factorial.should == 2*1 }
@bbasata
bbasata / StackTest.java
Created November 5, 2011 02:02
An example of BDD-influenced use of JUnit
import org.junit.Test;
import java.util.EmptyStackException;
import java.util.Stack;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
public class StackTest {
Stack<String> stack = new Stack<String>();