Skip to content

Instantly share code, notes, and snippets.

View bdthinh's full-sized avatar
🎯
Focusing

Thinh D. Bui bdthinh

🎯
Focusing
View GitHub Profile
@bdthinh
bdthinh / DeepNLP_Fujita-san
Created October 2, 2014 09:23
Fujita-san's presentation in DEEPNLP Meeting
what difference between daily-conversation and other document
problem: understanding natural language.
40 dialogues
with 327 sentences: each average 8 sentences / dialogues
google as SMT
yahoo as RBMT
the way to present the procedure of experiment is amazing ==> Understand deeply
what is no significant effect? (by ANOVA, p < 0.05)
q:how confidence answer affect the results? ==> solven
-ea
-server
-Xms1g
-Xmx1g
-Xss16m
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+UnlockExperimentalVMOptions
-XX:+UseConcMarkSweepGC
-XX:LargePageSizeInBytes=256m
@bdthinh
bdthinh / gsl-error-bundle
Created April 10, 2015 10:41
Error on bundle install gsl gem
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.4.2
Using RedCloth 4.2.9
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
@bdthinh
bdthinh / postgresql_database_tasks.rb
Created April 18, 2015 12:14
For psql with Rails 4
module ActiveRecord
module Tasks
class PostgreSQLDatabaseTasks
def drop
establish_master_connection
connection.select_all "select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where datname='#{configuration['database']}' AND state='idle';"
connection.drop_database configuration['database']
end
end
end
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@bdthinh
bdthinh / config with Terminator
Created August 22, 2013 03:30
How to make rails default for all apps
rvm gemset create rails-3.2.3
rvm use 1.9.3@rails-3.2.3 --default
gem install rails
@bdthinh
bdthinh / Capybara cheatsheet
Created August 22, 2013 11:28
Capybara cheatsheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@bdthinh
bdthinh / def method cheatsheet
Last active December 21, 2015 19:39
def method
def method_name(x1,x2,x3,x4)
def method_name(name,mode ='r')
def method_name(options)
def method_name(*points)
def story2(options={})
options = { person: "Yankee Doodle", animal: "Tiger" }.merge(options)
"#{options[:person]} went to town, riding on a #{options[:animal]}"
end
@bdthinh
bdthinh / Standard rails
Last active December 21, 2015 20:29
Rails 3.2 Development Standards Guide
class MyModel < ActiveRecord::Base
# extends ...................................................................
# includes ..................................................................
# security (i.e. attr_accessible) ...........................................
# relationships .............................................................
# validations ...............................................................
# callbacks .................................................................
# scopes ....................................................................
# additional config .........................................................
# class methods .............................................................

Capybara

save_and_open_page

Matchers

have_button(locator)