# for loop
for (var; kondisi; increment){}
# while loop
while (kondisi){}
This file contains hidden or 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
/** | |
* Generates JavaScript version of HTML templates for AngularJS as part of a Grunt build | |
* | |
* Allows for bundling into multiple collections, for applications that are distributed across more than one page. | |
* | |
* Usage (in grunt.initConfig): | |
* | |
* html2js: { | |
* firstTemplateCollection: { | |
* src: ['<%= src.first %>'], |
This file contains hidden or 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
[core] | |
excludesfile = /path/to/global/.gitignore | |
quotepath = false | |
editor = sublime -w | |
[user] | |
name = [your name] | |
email = [your email] | |
[mergetool] |
This file contains hidden or 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 'function' | |
# A fibonacci function. | |
fib = Function.new | |
fib[0] = 0 | |
fib[1] = 1 | |
fib[Integer] = proc { |i| fib[i - 2] + fib[i - 1] } | |
p fib[0] # => 0 |
This file contains hidden or 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 faktorial(angka): | |
if angka <= 1: | |
return 1 | |
else: | |
return angka*faktorial(angka-1) | |
for angka in range(angka,angka+1): | |
print "%d ! = %d" %(angka, faktorial(angka)) |
follow official guide
$ echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-9.3 postgresql-contrib-9.3
you should succesfully installing postgresql 9.3.2 on your machine.
This file contains hidden or 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 Jekyll | |
class LessConverter < Converter | |
safe true | |
priority :high | |
def setup | |
return if @setup | |
require 'less' | |
@setup = true | |
rescue LoadError |
This file contains hidden or 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
# generate using this gems : http://rubygems.org/gems/terminal-table | |
require "terminal-table" | |
title = "posts" | |
properties = ["id", "title", "author_name", "body"] | |
r = [] | |
r << [1, "I love dogs", "John", "woof"] | |
r << [2, "cars are great", "Sara", "I think they are"] |
This file contains hidden or 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
## Week 3 Quiz | |
## 1) What does ERB stand for? | |
Embedded Ruby | |
## 2) What is the name of the place (library) where additional built in Ruby functions can be accessed? | |
STDlib |