Skip to content

Instantly share code, notes, and snippets.

View dimasjt's full-sized avatar
🤓

Dimas J. Taniawan dimasjt

🤓
View GitHub Profile
@dimasjt
dimasjt / sublime.json
Created January 27, 2016 03:53
My Preferences setting for sublime text
{
"auto_complete": true,
"color_scheme": "Packages/User/SublimeLinter/LAZY (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_size": 10,
"ignored_packages":
[
"Vintage"
],
"material_theme_contrast_mode": true,
@dimasjt
dimasjt / queries.rb
Created November 23, 2015 06:55
query object with type data array
Group.where("categories @> string_to_array(?, '')", ['Laut', 'Wisata']) # contain in
# http://www.postgresql.org/docs/9.1/static/functions-array.html
@dimasjt
dimasjt / routes.rb
Created November 17, 2015 09:44
rescue from routing error
# routes.rb
match "*path", to: "application#record_not_found", via: :all
# application_controller#record_not_found
def record_not_found
render 'public/404'
end
@dimasjt
dimasjt / authenticate.rb
Created November 15, 2015 09:02
authenticate http basic
def authenticate
if Rails.env.staging?
authenticate_or_request_with_http_basic do |username, password|
username == 'username' && password == 'password'
end
end
end
@dimasjt
dimasjt / cities.rb
Created November 11, 2015 06:05
indonesia province, city
puts "start create Provinsi and city on indonesia"
location = {
"Indonesia" => {
"Bali" => [
'Karangasem',
'Badung',
'Bangli',
'Buleleng',
'Klungkung',
'Tabanan',
Dear [email protected]
We have received your password recovery request.
recover password
If you didn't request this, please ignore this email.
Your password won't change until you access the link above and create a new one.
Hi Dimas ,
You have created order on mmlodging.com .
This is the list of your checkouts :
Lodging Name Room Type Max Guest Check In Check Out Price/Night No of Rooms Nights Price
Total Price $138.00
Yangon Hostel Executive Room 20/01/2015 22/01/2015 3 guests $60.00 1 2 $120.00
Dear Dimas ,
Your rooms with type:
Executive Room
Already confirmed
Regards MMLodging Team
def success
if params[:token]
if session[:checkout_user] && session[:checkouts]
checkout = session[:checkout_user]
total = session[:checkouts][:total_price] * 100
purchase = EXPRESS_GATEWAY.purchase(total,
:ip => request.ip,
:token => params[:token],
:payer_id => params[:PayerID]
)