This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case @obat | |
when "sering sakit" | |
"puasa sunnah" | |
when "wajah terlihat murung tidak bercahaya" | |
"shalat malam tahajud" | |
when "hati sempit" | |
"baca Al-Quran dan maknanya" | |
when "tidak bahagia" | |
"shalat diawal waktu" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TextProcessingHelper | |
MAIN_ARR = [ | |
['dr', 'dari'], | |
['dl', 'dalam'], | |
['dng', 'dengan'], | |
['dsb', 'dan sebagainya'], | |
['dp', 'dari pada'], | |
['dst', 'dan seterusnya'], | |
['krn', 'karna'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "sinatra" | |
require_relative "my_db" | |
class App < Sinatra::Base | |
get '/' do | |
return "Hello from Sinatra.rb" | |
end | |
get '/show_komedian' do | |
content_type :json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "mysql2" | |
class MyDatabase | |
def initialize | |
@client = Mysql2::Client.new( | |
:host => "localhost", | |
:username => "root", | |
:password => "yourpassword", | |
:database => "sinatra" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './app' | |
run App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
# main gems | |
gem 'sinatra' | |
gem 'mysql2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RedisProjectHelper | |
# set hash | |
def set_project!(sample_store_id, sample_store_name) | |
$redis.multi do | |
$redis.hset(self.redis_new_project_key(), 'sample_id', sample_store_id) | |
$redis.hset(self.redis_new_project_key(), 'sample_name', sample_store_name) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# select user where id not in and where translator category is | |
def search | |
User.includes(:levels, :translator_categories).where('levels.name = ? AND translator_categories.name = ?', 'translator', 'Umum').where('users.id NOT IN (?)', [1,5,3,2]).references(:levels, :translator_categories) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.create_aoh | |
aoh_hash = { project: [] } | |
self.all.each do |order| | |
aoh_hash[:orders] << { | |
text: order.texts.pluck(:id), | |
text_count: order.texts.pluck(:words), | |
doc: order.documents.pluck(:id), | |
doc_count: order.documents.pluck(:words) | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# File: /etc/init.d/sidekiq | |
# thanks to http://tsaith.github.io/install-sidekiq-and-redis-on-ubuntu.html | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 |