Skip to content

Instantly share code, notes, and snippets.

View onesup's full-sized avatar

이원섭wonsup Lee/Alfonso onesup

View GitHub Profile
@onesup
onesup / es.sh
Created November 22, 2012 23:59 — forked from aaronshaf/es.sh
Install ElasticSearch on Ubuntu 11.04
cd ~
sudo apt-get update
sudo apt-get install unzip curl python-software-properties -y
#sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
@onesup
onesup / unicorn.log
Created May 13, 2013 13:21
unicorn 이 `parse': (<unknown>): mapping values are not allowed in this context at line 22 column 11 (Psych::SyntaxError) 문제로 실행이 안될 때 아래 문서 참고. http://stackoverflow.com/questions/4980877/rails-error-couldnt-parse-yaml
/home/daul/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): mapping values are not allowed in this context at line 22 column 11 (Psych::SyntaxError)
from /home/daul/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from /home/daul/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:151:in `parse'
from /home/daul/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:127:in `load'
from /home/daul/repang/shared/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/application/configuration.rb:115:in `database_configuration'
from /home/daul/repang/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/railtie.rb:78:in `block (2 levels) in <class:Railtie>'
from /home/daul/repang/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /home/daul/repang/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/daul/repang/shared/
@onesup
onesup / README.md
Last active December 17, 2015 06:59 — forked from keikubo/README.md

Nginx + Unicorn for Rails on Rackhub

Description:

This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn.

Installation:

Please make sure that your Gemfile in your rails application includes unicorn.

@onesup
onesup / database.yml
Created May 14, 2013 02:56
nginx + unicorn + capistrano 를 이용한 배포에 필요한 설정파일들.
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
@onesup
onesup / gist:5693939
Created June 2, 2013 16:00
cap deploy 메세지
daul-ui-MacBook-Air:repang daul$ cap deploy
* 2013-06-03 00:56:50 executing `deploy'
triggering before callbacks for `deploy'
* 2013-06-03 00:56:50 executing `deploy:check_revision'
* 2013-06-03 00:56:50 executing `deploy:update'
** transaction: start
* 2013-06-03 00:56:50 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote [email protected]:onesup/repang.git master"
command finished in 7824ms
@onesup
onesup / coupon.rb
Created August 18, 2013 16:11
쿠폰 발행 관련 코드
class Coupon < ActiveRecord::Base
belongs_to :user
#published, used, new
#쿠폰 사용 약관에 "회원 탈퇴 시 쿠폰또한 삭제됩니다. 라고 명시해야함."
def self.valid?(code, user=nil)
if self.exists?(:code => code)
coupons = self.where(:code => code)
coupon = coupons.first
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : '<%= FACEBOOK_CONFIG[:app_id] %>', // App ID from the app dashboard
channelUrl : '//<%= FACEBOOK_CONFIG[:domain] %>/channel.html', // Channel file for x-domain comms
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.getLoginStatus(function(response) {
@onesup
onesup / gist:8398650
Created January 13, 2014 11:19
트랙킹 코드
$('#behind_tracking').bind('click', function(e) {
e.preventDefault();
$.ajax({
url:"http://i85.icast-ad.com/track?ccd=1185&mcd=01040601&pcd=1505",
type: "GET",
success: function(response) {
window.location.href = $('#behind_tracking').attr("href");
},
headers: {
'X-Transaction': 'POST Example',
@onesup
onesup / gist:8398746
Created January 13, 2014 11:27
ie에서 외부 정보 찍어올때 에러.
$.ajax({
url:"http://i85.icast-ad.com/track?ccd=1185&mcd=01040601&pcd=1504",
type: "GET",
success: function(response) {
window.location.href = $('#event_tracking').attr("href");
},error:function(XMLHttpRequest,status,error){
window.location.href = $('#event_tracking').attr("href");
},
headers: {
'X-Transaction': 'POST Example',
@onesup
onesup / deploy.rb
Created January 20, 2014 16:25
deploy
require "bundler/capistrano"
require "net/sftp"
set :rails_env, "production" #added for delayed job
set :application, "kfarm"
set :user, "onesup"
set :deploy_to, "/home/#{user}/#{application}"
set :deploy_via, :copy
set :use_sudo, false
set :scm, "git"