Skip to content

Instantly share code, notes, and snippets.

View pyk's full-sized avatar
🐈‍⬛
I may be slow to respond.

pyk pyk

🐈‍⬛
I may be slow to respond.
View GitHub Profile
/**
* 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 %>'],
@pyk
pyk / .gitconfig
Last active December 27, 2015 10:39
my git configuration file - allways write nice look git commit using sublime text - bunch of usefull git aliases
[core]
excludesfile = /path/to/global/.gitignore
quotepath = false
editor = sublime -w
[user]
name = [your name]
email = [your email]
[mergetool]
@pyk
pyk / example.rb
Created December 18, 2013 07:28 — forked from britishtea/example.rb
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
@pyk
pyk / faktorial.py
Created December 22, 2013 01:57
fungsi faktorial.
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))
@pyk
pyk / kenapa-kok-infinite.md
Last active January 1, 2016 07:48
kenapa kok infinite

kenapa kok infinite?

Konsep dasar loop di javascript

# for loop
for (var; kondisi; increment){}

# while loop
while (kondisi){}
@pyk
pyk / installing postgresql 9.3.2 on ubuntu 12.04.md
Created January 3, 2014 18:05
installing postgresql 9.3.2 on ubuntu 12.04 . with error fix: ummet dependencies

installing postgresql 9.3.2 on ubuntu 12.04

$ 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.

@pyk
pyk / less_converter.rb
Last active January 2, 2016 18:49 — forked from KBalderson/less_converter.rb
Using LESS on Jekyll site . for using intructions see here https://kippt.com/bayu/notes/clips/18862841
module Jekyll
class LessConverter < Converter
safe true
priority :high
def setup
return if @setup
require 'less'
@setup = true
rescue LoadError
@pyk
pyk / active-record-migration-expert.md
Last active August 2, 2021 09:20
become active record migration expert (Rails 4.0.2)

become active record migration expert (Rails 4.0.2)

workflow:

create model

$ rails g model NameOfModel
    invoke  active_record
    create    db/migrate/YYYYMMDDHHMMSS_create_name_of_models.rb
# 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"]
@pyk
pyk / gist:8613205
Last active January 4, 2016 11:09 — forked from schneems/gist:3036609
## 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