Skip to content

Instantly share code, notes, and snippets.

View henggana's full-sized avatar
🐈‍⬛

Segi Henggana henggana

🐈‍⬛
View GitHub Profile
@henggana
henggana / jquery-to-vanilla-js.md
Created November 30, 2015 08:50 — forked from jhafner/jquery-to-vanilla-js.md
jQuery methods in vanilla JavaScript.

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@henggana
henggana / arel_collections.rb
Created November 26, 2015 03:40
Collection of Arel query
# LIKE
users = User.arel_table
query_string = "%#{params[query]}%"
User.where(users[:name].matches(query_string)\
.or(users[:description].matches(query_string)))
@henggana
henggana / gist:23f92bbf3364ae9caa1e
Created November 18, 2015 05:03 — forked from ryansobol/gist:5252653
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@henggana
henggana / backend-architectures.md
Created November 18, 2015 05:02 — forked from ragingwind/Backend Architectures Keywords and References.md
Backend Architectures Keywords and References. #wiki
@henggana
henggana / capybara.md
Created November 18, 2015 04:47 — forked from steveclarke/capybara.md
RSpec Matchers

Capybara

save_and_open_page

Matchers

have_button(locator)
@henggana
henggana / 0. nginx_setup.sh
Created November 18, 2015 04:47 — forked from mikhailov/0. nginx_setup.sh
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@henggana
henggana / gist:bec155252f219faa1bd4
Created November 18, 2015 04:45 — forked from dhh/gist:1014971
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@henggana
henggana / digitalocean.md
Created November 18, 2015 04:44 — forked from JamesDullaghan/digitalocean.md
Deploy rails app to digitalocean with nginx, unicorn, capistrano & postgres

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email

@henggana
henggana / database.yml.example mysql2
Created November 18, 2015 04:43 — forked from erichurst/database.yml.example mysql2
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@henggana
henggana / gist:1f14ca5029e1ef2ba9f9
Created November 18, 2015 04:43 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".