Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

David Angga Prasetya #6

Closed
wants to merge 12 commits into from

2 participants

Commits on Apr 12, 2012
  1. @david-angga

    questionnaire answered

    david-angga authored
  2. @david-angga

    Cover Letter added

    david-angga authored
  3. @david-angga

    refactoring template.rb

    david-angga authored
  4. @david-angga

    adding Sinatra Skeleton

    david-angga authored
  5. @david-angga

    added spec test

    david-angga authored
  6. @david-angga

    adding index

    david-angga authored
  7. @david-angga

    added evmrc

    david-angga authored
  8. @david-angga

    added spec

    david-angga authored
  9. @david-angga

    fix spec test

    david-angga authored
  10. @david-angga
  11. @david-angga

    quetionnaire update

    david-angga authored
Commits on May 8, 2012
  1. remove cover

    David Angga Prasetya authored
This page is out of date. Refresh to see the latest.
View
81 simple_public_timeline/.rvmrc
@@ -0,0 +1,81 @@
+#!/usr/bin/env bash
+
+# This is an RVM Project .rvmrc file, used to automatically load the ruby
+# development environment upon cd'ing into the directory
+
+# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
+environment_id="ruby-1.9.2-p290@sin"
+
+#
+# Uncomment the following lines if you want to verify rvm version per project
+#
+# rvmrc_rvm_version="1.10.2" # 1.10.1 seams as a safe start
+# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
+# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
+# return 1
+# }
+#
+
+#
+# Uncomment following line if you want options to be set only for given project.
+#
+# PROJECT_JRUBY_OPTS=( --1.9 )
+#
+# The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
+#
+# chmod +x ${rvm_path}/hooks/after_use_jruby_opts
+#
+
+#
+# First we attempt to load the desired environment directly from the environment
+# file. This is very fast and efficient compared to running through the entire
+# CLI and selector. If you want feedback on which environment was used then
+# insert the word 'use' after --create as this triggers verbose mode.
+#
+if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
+then
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
+
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
+ then
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
+ fi
+else
+ # If the environment file has not yet been created, use the RVM CLI to select.
+ if ! rvm --create "$environment_id"
+ then
+ echo "Failed to create RVM environment '${environment_id}'."
+ return 1
+ fi
+fi
+
+#
+# If you use an RVM gemset file to install a list of gems (*.gems), you can have
+# it be automatically loaded. Uncomment the following and adjust the filename if
+# necessary.
+#
+# filename=".gems"
+# if [[ -s "$filename" ]]
+# then
+# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
+# fi
+
+# If you use bundler, this might be useful to you:
+# if [[ -s Gemfile ]] && ! command -v bundle >/dev/null
+# then
+# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
+# gem install bundler
+# fi
+# if [[ -s Gemfile ]] && command -v bundle
+# then
+# bundle install
+# fi
+
+if [[ $- == *i* ]] # check for interactive shells
+then
+ echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
+else
+ echo "Using: $GEM_HOME" # don't use colors in interactive shells
+fi
+
View
11 simple_public_timeline/Gemfile
@@ -0,0 +1,11 @@
+source :rubygems
+source :rubyforge
+
+
+gem "sinatra", :require => "sinatra/base"
+gem "twitter"
+
+group :test do
+ gem "rspec", '=2.4.0'
+end
+
View
16 simple_public_timeline/Gemfile.lock
@@ -0,0 +1,16 @@
+GEM
+ specs:
+ rack (1.4.1)
+ rack-protection (1.2.0)
+ rack
+ sinatra (1.3.2)
+ rack (~> 1.3, >= 1.3.6)
+ rack-protection (~> 1.2)
+ tilt (~> 1.3, >= 1.3.3)
+ tilt (1.3.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ sinatra
View
9 simple_public_timeline/Rakefile
@@ -0,0 +1,9 @@
+require 'rspec/core/rake_task'
+
+task :default => "spec"
+
+RSpec::Core::RakeTask.new do |t|
+ t.pattern = "./*_spec.rb"
+ # Put spec opts in a file named .rspec in root
+end
+
View
7 simple_public_timeline/config.ru
@@ -0,0 +1,7 @@
+require 'rubygems'
+require 'bundler'
+
+Bundler.require
+
+require './public_timeline'
+run PublicTimeline
View
25 simple_public_timeline/public_timeline.rb
@@ -0,0 +1,25 @@
+require "sinatra"
+require "twitter"
+class PublicTimeline < Sinatra::Base
+ helpers do
+ def extract_source source
+ unless (source.to_s =~ /\&gt\;(.+?)\&lt/).nil?
+ string = $1
+ end
+ string
+ end
+ end
+
+ def self.get_recent_tweets
+ Twitter.search("popular tweets", :rpp => 20, :result_type => "recent")
+ end
+
+ get "/" do
+ @results = PublicTimeline::get_recent_tweets
+ erb :index
+ end
+
+ get "/via_js" do
+ erb :via_js
+ end
+end
View
9 simple_public_timeline/public_timeline_spec.rb
@@ -0,0 +1,9 @@
+require_relative 'public_timeline'
+
+describe PublicTimeline do
+
+ it "#get_recent_tweets should return 20 most recent Tweets" do
+ PublicTimeline::get_recent_tweets.length.should == 20
+ end
+
+end
View
10 simple_public_timeline/views/index.erb
@@ -0,0 +1,10 @@
+<h1>Recent Public Tweets</h1>
+<h3>What everyone on Twitter is talking about</h3>
+<% unless @results.nil? %>
+ <% @results.each do |res| %>
+ <img src="<%= res.profile_image_url %>"> &nbsp;<b><a href="http://twitter.com/<%= res.from_user_name %>"><%= res.from_user_name %></a></b>&nbsp;<%= res.text %><br/>
+ <small><%= res.created_at %> via <%= extract_source res.source %></small>
+ <br/><br/>
+ <% end %>
+<% end %>
+
View
18 simple_public_timeline/views/via_js.erb
@@ -0,0 +1,18 @@
+<script src="http://code.jquery.com/jquery-latest.js"></script>
+<script type="text/javascript">
+ function reloadIndex(){
+ $.ajax({
+ url: '/',
+ beforeSend: function(request){
+ $('#bodyContainer').html('loading...');
+ },
+ success: function(request){
+ $('#bodyContainer').html(request);}
+ });
+ }
+</script>
+
+<body onload="reloadIndex();">
+ <div id="bodyContainer">
+ </div>
+</body>
View
24 simple_refactoring_exercise/template.rb
@@ -1,26 +1,6 @@
module Template
def template(source_template, req_id)
- template = String.new(source_template)
-
- # Substitute for %CODE%
- template_split_begin = template.index("%CODE%")
- template_split_end = template_split_begin + 6
- template_part_one =
- String.new(template[0..(template_split_begin-1)])
- template_part_two =
- String.new(template[template_split_end..template.length])
- code = String.new(req_id)
- template =
- String.new(template_part_one + code + template_part_two)
-
- # Substitute for %ALTCODE%
- template_split_begin = template.index("%ALTCODE%")
- template_split_end = template_split_begin + 9
- template_part_one =
- String.new(template[0..(template_split_begin-1)])
- template_part_two =
- String.new(template[template_split_end..template.length])
- altcode = code[0..4] + "-" + code[5..7]
- template_part_one + altcode + template_part_two
+ # change %CODE% to req_id and %ALTCODE% to req_id formula based on the test spec
+ source_template.gsub("%CODE%", req_id).gsub("%ALTCODE%","#{req_id[0..4]}-#{req_id[5..7]}")
end
end
View
15 why_hire_me/questionnaire.txt
@@ -1,25 +1,38 @@
How many years of Web development experience do you have?
+5 years
How many years of JavaScript experience do you have?
+5 years
How many years of Ruby experience do you have?
+4 years
How many years of Rails development experience do you have?
+4 years
What are your opinions on Agile software development?
-
+Agile can quickly response to changes and provide immediate result with less efforts.
TDD or BDD?
+BDD
What are you looking for in a job?
+experience, satisfaction, and the opportunity to learn something new.
+enter the community to keep my knowledge up to date.
Are you legal to work in the US?
+not yet
When can you start?
+3 months after notice
+
+
+i'm comfortable working on both Linux and Mac environment.
+i'm an ubuntu user for the past 2 years since my office mac broke down. Haven't got any change to buy a new one.
Something went wrong with that request. Please try again.