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 / uninstall_gems.sh
Created September 6, 2016 06:46 — forked from IanVaughan/uninstall_gems.sh
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
@bdthinh
bdthinh / Sublime Text 3 Build 3103 License Key - CRACK
Created September 4, 2016 16:34
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
#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 / 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
@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
-ea
-server
-Xms1g
-Xmx1g
-Xss16m
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+UnlockExperimentalVMOptions
-XX:+UseConcMarkSweepGC
-XX:LargePageSizeInBytes=256m
@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
@bdthinh
bdthinh / spec_helper.rb
Created September 6, 2013 20:29
My default spec_helper With capybara - factorygirl - database_cleaner config
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
require 'factories/seeds'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
@bdthinh
bdthinh / RoR operator trick
Created September 3, 2013 20:12
Some trick with operator in RoR
user_name = (user.authenticated? && user.name) || 'guest'

Capybara

save_and_open_page

Matchers

have_button(locator)