Skip to content

Instantly share code, notes, and snippets.

View muhammadyana's full-sized avatar
🏠
Work From Anywhere

Muhammad Yana Mulyana muhammadyana

🏠
Work From Anywhere
View GitHub Profile
1. Do not repeat yourself (DRY). Meaning there shall no duplicate code
2. Tiny Controller Fat Model. Meaning all business logic shall be placed on Models NOT Controllers
3. Use framework plugins as much as possible for speedying up your software development
3.1 Ruby on Rails https://github.com/hothero/awesome-rails-gem
3.2 Laravel https://github.com/chiraggude/awesome-laravel
3.3 Django https://github.com/rosarior/awesome-django
3.4 Bootstrap https://bootstrapious.com/p/best-bootstrap-plugins
3.5 JQuery http://hasinhayder.github.io/essential-jquery-plugins/
3.6 VueJS https://github.com/vuejs/awesome-vue
3.7 React https://github.com/enaqx/awesome-react
@muhammadyana
muhammadyana / index.html
Created June 7, 2017 04:40 — forked from hendra/index.html
Standard HTML Template
<!DOCTYPE html>
<html lang="en">
<head>
<title>Page title | website or product name</title>
<meta name="description" content="lorem ipsum dolor set amet" /> <!--Max 160 characters-->
<meta name="keywords" content="keyword1, keyword2, keyword3" />
<meta charset="utf-8" />
<!--Responsive using bootstrap-->
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
@muhammadyana
muhammadyana / ruby-basic-progamming.rb
Last active June 8, 2017 04:08
ruby-basic-progamming
def Hallo(name, age)
tmp = "Hallo #{name.upcase} your age is \n #{age}"
end
language = ["java", "html", "css", "ruby"]
anotherMethod = %w{java html css ruby go}
#puts language.inspect #show all element in array
#puts anotherMethod[0]
#puts Hallo("yana", 24)
a = %w{ ant bee cat dog elk }
#puts a[0] # => "ant"
a = [1, 3, "cat"]
b = {
dog: "ben",
cat: "tom"
}
enum_a = a.to_enum #untuk
enum_b = b.to_enum
enum_a1 = a.each
@muhammadyana
muhammadyana / lambda-and-proc-in-ruby.rb
Last active June 8, 2017 04:07
same as method, but it can be assign or set like a variable
print "Enter value Integer = "
int = gets.chomp.to_i
print "Enter value string = "
string = gets.chomp.to_s
def n_times(thing)
lambda {
|n|
thing * n
}
@muhammadyana
muhammadyana / block-can-be-object.rb
Last active June 8, 2017 04:07
Block also can be an object in ruby
print "Enter parameter = "
var = gets()
class ProcExample
def pass_in_block(&action)
@stored_proc = action
end
def use_proc(parameter)
@stored_proc.call(parameter) #call the parameter
end
#
# require_relative 'words_from_string'
# require 'test/unit'
#
# class TestWordsFromString < Test::unit::Testcase
# def test_empty_string
# assert_equal(
# [], words_from_string("")
# )
# assert_equal(
#thursday-08-2017
#@41studio
#Muhammad Yana Mulyana
#inheritance in ruby
class Parent
def say_hello
puts "Hello From #{self}"
end
end
#thursday-08-2017
#@41studio
#Muhammad Yana Mulyana
#mixins in ruby
puts "Enter Name 1 "
name1 = gets.chomp.to_s
puts "Enter name 2 "
name2 = gets.chomp.to_s
puts "Enyer Name 3 "
@muhammadyana
muhammadyana / standar-type.rb
Last active June 8, 2017 04:19
Standar Type in Ruby
#thursday-08-2017
#@41studio
#Muhammad Yana Mulyana
#mixins in ruby
puts "Enter count of loop "
lp = gets.chomp.to_i
puts "Enter value to calculate "
val = gets.chomp.to_i
num = val
lp.times do