Skip to content

Instantly share code, notes, and snippets.

View kuntoaji's full-sized avatar
🎯
Focusing

KAK kuntoaji

🎯
Focusing
View GitHub Profile
class UserSessionsController < ApplicationController
before_filter :require_logout, :only => [:new, :create, :auth_fb_connect]
before_filter :set_facebook_session, :only => [:new, :create, :destroy, :auth_fb_connect]
helper_method :facebook_session, :only => [:new, :create, :destroy, :auth_fb_connect]
def new
@user_session = UserSession.new
end
def create
class UserSession < Authlogic::Session::Base
end
puts hellow world with gist client
puts 'hellow world with gist client'
@kuntoaji
kuntoaji / hashtag_counter.rb
Created September 21, 2010 07:15
Ruby script to count a twitter hashtag and save the result and last_tweet_id to hashtag_counter_result.txt and last_tweet_id.tx
#!/usr/bin/env ruby
# Twitter Hashtag Counter
#
# Script to count a twitter hashtag and save the result and last_tweet_id to
# hashtag_counter_result.txt and last_tweet_id.txt
#
# Requirements: twitter gem.
# To install twitter gem: [sudo] gem install twitter
require 'rubygems'
PATH="/opt/rubinius/1.2/gems/bin/:/opt/rubinius/1.2/bin:$PATH"
@kuntoaji
kuntoaji / progress_bar.rb
Created September 6, 2013 06:54
Simple progress bar script without Gem using Ruby.
#!/usr/bin/env ruby
progress = 'Progress ['
1000.times do |i|
# i is number from 0-999
j = i + 1
# add 1 percent every 10 times
if j % 10 == 0
@kuntoaji
kuntoaji / README.md
Created October 13, 2013 05:40 — forked from nikcub/README.md
@kuntoaji
kuntoaji / main.js
Last active December 28, 2015 08:39
Javascript Alert For Unsaved Changes with Turbolinks and Jquery
// ...
change = function() {
$("form input, form textarea").change(function() {
$('a').click(function() {
confirm('Unsaved changes on the page. Are you sure?');
});
});
};
// ...
@kuntoaji
kuntoaji / nginx.conf
Last active August 29, 2015 13:55
Nginx Load Balancer Configuration
# default nginx configuration
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;