Skip to content

Instantly share code, notes, and snippets.

View bekicot's full-sized avatar
🏠
Working from home

Yana Agun Siswanto bekicot

🏠
Working from home
View GitHub Profile
@bekicot
bekicot / .gemrc
Created October 14, 2013 09:32
Gem Rc Profile
# ~/.gemrc
---
:verbose: true
:bulk_threshold: 1000
install: --no-ri --no-rdoc --env-shebang
:sources:
- http://gemcutter.org
- http://gems.rubyforge.org/
- http://gems.github.com
:benchmark: false
@bekicot
bekicot / Ruby With Readline
Last active December 26, 2015 06:59
Ruby With Readline
# ruby with readline to prevent headache
sudo apt-get install libreadline-dev
CONFIGURE_OPTS="--with-readline-dir=/usr/include/readline" rbenv install 1.9.3-p392 # <= change with ruby version
# Source http://vvv.tobiassjosten.net/ruby/readline-in-ruby-with-rbenv/
sudo apt-get install
sudo apt-get upgrade
sudo apt-get install libmysql-ruby libmysqlclient-dev
# PostgreSQL dependecies
sudo apt-get install libpq-dev
sudo apt-get install libssl-dev
sudo apt-get install libssl0.9.8
sudo apt-get install libreadline-dev
# test 1st
sudo rmmod hid_magicmouse
# scroll-speed value from 0 (slow) to 63 (fast). Current setting is 45:
sudo modprobe hid_magicmouse scroll-speed=45 scroll-acceleration=1
# For permanent settings put to the /etc/modprobe.d/magicmouse.conf this:
# options hid_magicmouse scroll-speed=45 scroll-acceleration=1
@bekicot
bekicot / Respond JS Rspec
Created November 12, 2013 06:17
Respond in JS for rspec controller
post :create, :hotel => {:name => 'California'}, :format => 'js'
=> credits 'https://github.com/rspec/rspec-rails/issues/189'

Setting up Ruby, Rails, Nginx, Passenger, PostgreSQL 9 on Ubuntu 12.04 LTS for Windows Azure

Last updated: 12/31/2013

Fix the locale issue

  • Edit /etc/default/locale as sudo.
  • Append LC_ALL="en_US.UTF-8" at the end of the file, save and quit.
  • sudo locale-gen en_US en_US.UTF-8
  • sudo dpkg-reconfigure locales

Install the necessary packages to install rbenv and build Ruby

#Scoped Invitation System for User Groups with Rails#

Starting out with the following models and associations:

####User

  • has_many :memberships
  • has_many :organizations through :memberships

####Organization (User Group)

  • has_many :memberships
<!-- /app/views/admin/users/new_invitiations.html.erb -->
<h2>Send invitation</h2>
<%= form_for @user, :url => send_invitation_admin_users_path do |f| %>
<table style='width: 50%'>
<tr>
<td><%= f.label :first_name %></td>
<td><%= f.text_field :first_name %></td>
require 'active_support'
require 'active_support/time'
class WaktuSubuh
attr_accessor :morning_hours
def initialize(options={})
@morning_hours = options[:morning_hours] || [6,7,8]
end
def morning_zone(hour_in_utc=0)
@bekicot
bekicot / hosts
Created December 16, 2016 16:55
List of sites to block. add it to /etc/hosts
# This MVPS HOSTS file is a free download from: #
# http://winhelp2002.mvps.org/hosts.htm #
# #
# Notes: The Operating System does not read the "#" symbol #
# You can create your own notes, after the # symbol #
# This *must* be the first line: 127.0.0.1 localhost #
# #
#**********************************************************#
# -------------- Updated: December-10-2016 --------------- #
#**********************************************************#